Skip to content

Commit 02ba7f0

Browse files
pavanputhraclaude
andauthored
Add LLM call tracing via Langfuse and OpenTelemetry (#139)
* Add LLM call tracing via Langfuse and OpenTelemetry - All OpenAI calls are now automatically traced with model name, token counts, and message content via OpenInference instrumentation - Langfuse (v3) available as an optional local dev service via docker compose profile; zero config needed to start tracing locally - Traces route to Langfuse via standard OTEL env vars — works with Langfuse cloud or self-hosted (configured in vconic-deploy) - docker-compose.yml is now committed and covers all optional services (postgres, elasticsearch, langfuse) via profiles CON-180 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix CI: remove stale example_docker-compose.yml copy step docker-compose.yml is now committed directly; the cp step is no longer needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update poetry.lock for openinference-instrumentation-openai dependency Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5f3350c commit 02ba7f0

10 files changed

Lines changed: 586 additions & 274 deletions

File tree

.env.example

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1+
# ── Docker Compose profiles ──────────────────────────────────────────────────
2+
# Comma-separated list of optional services to run locally.
3+
# Available: redis, postgres, elasticsearch
4+
# Remove a service if you're pointing to an external instance instead.
5+
COMPOSE_PROFILES=postgres
6+
7+
# ── Redis ─────────────────────────────────────────────────────────────────────
8+
# Use redis://redis when running the redis profile locally.
9+
# Use redis://<host> when pointing to an external instance.
110
REDIS_URL=redis://redis
211

3-
# Leave this blank to disable API security
4-
# You set this before opening the port in your firewall
12+
# ── API ───────────────────────────────────────────────────────────────────────
13+
# Leave blank to disable API key security.
14+
# Set before opening the port in your firewall.
515
CONSERVER_API_TOKEN=
616

7-
# to customize the config copy example_config.yml to config.yml
8-
# modify the values in config.yml as needed
9-
# and set CONSERVER_CONFIG_FILE to ./config.yml below
17+
# ── Config ────────────────────────────────────────────────────────────────────
18+
# Copy example_config.yml to config.yml, modify as needed, then set this path.
1019
CONSERVER_CONFIG_FILE=
1120
LOGGING_CONFIG_FILE=server/logging_dev.conf
1221

13-
# Groq API key for Whisper transcription
14-
GROQ_API_KEY=your_groq_api_key_here
22+
23+
# ── OpenTelemetry ─────────────────────────────────────────────────────────────
24+
# Leave OTEL_EXPORTER_OTLP_ENDPOINT blank to disable tracing.
25+
#
26+
# Local Langfuse (add 'langfuse' to COMPOSE_PROFILES, then use pre-seeded creds):
27+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://langfuse-server:3000/api/public/otel
28+
# OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
29+
# OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic cGstbGYtbG9jYWxkZXY6c2stbGYtbG9jYWxkZXY=
30+
# (pre-seeded: pk-lf-localdev / sk-lf-localdev, UI at http://localhost:3000, admin@langfuse.local / admin1234)
31+
#
32+
# Langfuse cloud:
33+
# OTEL_EXPORTER_OTLP_ENDPOINT=https://cloud.langfuse.com/api/public/otel
34+
# OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
35+
# OTEL_EXPORTER_OTLP_HEADERS=Authorization=Basic <base64(public_key:secret_key)>
36+
# Generate: echo -n "pk-lf-xxx:sk-lf-xxx" | base64
37+
#
38+
# SigNoz / OTEL collector (gRPC):
39+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://signoz-otel-collector:4317
40+
# OTEL_EXPORTER_OTLP_PROTOCOL=grpc
41+
# OTEL_EXPORTER_OTLP_INSECURE=true
42+
OTEL_EXPORTER_OTLP_ENDPOINT=
43+
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
44+
OTEL_EXPORTER_OTLP_INSECURE=false
45+
OTEL_EXPORTER_OTLP_HEADERS=

.github/workflows/run-tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Python conserver unit test
2-
on:
2+
on:
33
push:
44
branches: [ main ] # only run on pushes to main branch
55
pull_request: # all PRs
@@ -17,10 +17,6 @@ jobs:
1717
run: |
1818
sudo apt-get update
1919
sudo apt-get install -y docker-compose
20-
21-
- name: Copy example_docker-compose.yml to docker-compose.yml
22-
run: |
23-
cp example_docker-compose.yml docker-compose.yml
2420
2521
- name: Create .env file
2622
run: |
@@ -35,7 +31,6 @@ jobs:
3531
run: |
3632
docker-compose up --build --detach
3733
38-
# Step 3: Run Docker container with additional commands
3934
- name: Run tests inside Docker container
4035
run: |
4136
docker-compose run --rm conserver bash -c "

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ venv
66

77
.vscode
88
docker-compose.override.yml
9-
docker-compose.yml
109
docker-compose.dev.yml
1110

1211
static

0 commit comments

Comments
 (0)