Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.
TypeScript agent-harnessagent-harness-engineeringai-engineeringai-observabilityamd-gpuclaude-codeclickhousecodexcoding-agentcoding-agentscursorgenaigpu-monitoringllm-observabilityllmopsnvidia-smiobservabilityopen-sourceopenaiopentelemetry
feat: make OTLP endpoints UI-configurable with per-signal support (#1175)
Aman Agarwalb6de5282ddbb
diff --git a/examples/anthropic-chat-app/app.py b/examples/anthropic-chat-app/app.pyindex bd57c6ee..f180fe20 100644--- a/examples/anthropic-chat-app/app.py+++ b/examples/anthropic-chat-app/app.py@@ -9,7 +9,7 @@ i = 0while True:try:resp = client.messages.create(- model="claude-3-haiku-20240307",+ model="claude-haiku-4-5-20251001",max_tokens=10,messages=[{"role": "user", "content": "hi"}],)diff --git a/examples/langgprah_agent.py b/examples/langgprah_agent.pydeleted file mode 100644index 5f1af4de..00000000--- a/examples/langgprah_agent.py+++ /dev/null@@ -1,200 +0,0 @@-"""-LangGraph Research Assistant Agent--A practical agent that takes a user question, searches the web for information,-extracts key facts, and produces a concise summary with sources. Demonstrates-tool usage, conditional routing, and state management in LangGraph.--Requirements:- pip install langgraph langchain-openai langchain-community httpx--Set OPENAI_API_KEY in your environment before running.-"""--import json-import os-from datetime import datetime, timezone-from typing import Annotated, TypedDict--import httpx-from httpx._transports import default-from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolMessage-from langchain_core.tools import tool-from langchain_openai import ChatOpenAI-from langgraph.graph import END, StateGraph-from langgraph.graph.message import add_messages-import openlit--openlit.init(- otlp_endpoint="https://ingress.europe-west4.gcp.dash0.com:4318",- otlp_headers={"Authorization": "Bearer auth_W2ieunheYgu1oYxAA9I0G35dG8aOjtun"}-)--# ----------------------------------------------------------------------------# State-# -----------------------------------------------------------------------------class AgentState(TypedDict):- messages: Annotated[list, add_messages]- search_results: list[dict]- summary: str---# ----------------------------------------------------------------------------# Tools-# -----------------------------------------------------------------------------@tool-def web_search(query: str) -> str:- """Search the web using DuckDuckGo Instant Answer API and return results."""- url = "https://api.duckduckgo.com/"- params = {"q": query, "format": "json", "no_html": 1, "skip_disambig": 1}- resp = httpx.get(url, params=params, timeout=10, follow_redirects=True)- data = resp.json()-- results: list[dict] = []- if data.get("AbstractText"):- results.append({"source": data.get("AbstractURL", ""), "text": data["AbstractText"]})- for topic in data.get("RelatedTopics", [])[:5]:- if "Text" in topic:- results.append({"source": topic.get("FirstURL", ""), "text": topic["Text"]})-- if not results:- return json.dumps({"results": [], "note": "No results found. Try rephrasing."})- return json.dumps({"results": results})---@tool-def get_current_datetime() -> str:- """Return the current UTC date and time."""- return datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S UTC")---@tool-def calculate(expression: str) -> str:- """Evaluate a mathematical expression safely and return the result."""- allowed = set("0123456789+-*/(). ")- if not all(ch in allowed for ch in expression):- return "Error: expression contains disallowed characters."- try:- result = eval(expression, {"__builtins__": {}}) # noqa: S307- return str(result)- except Exception as exc:- return f"Error: {exc}"---TOOLS = [web_search, get_current_datetime, calculate]-TOOL_MAP = {t.name: t for t in TOOLS}---# ----------------------------------------------------------------------------# LLM-# -----------------------------------------------------------------------------def build_llm() -> ChatOpenAI:- return ChatOpenAI(model="gpt-4o-mini", temperature=0).bind_tools(TOOLS)---SYSTEM_PROMPT = (- "You are a helpful research assistant. When the user asks a question:\n"- "1. Use `web_search` to find relevant information.\n"- "2. Use `get_current_datetime` if the question involves dates or times.\n"- "3. Use `calculate` for any arithmetic.\n"- "4. After gathering information, provide a concise, well-structured summary "- "with inline source URLs where applicable.\n"- "Always cite your sources."-)---# ----------------------------------------------------------------------------# Graph nodes-# -----------------------------------------------------------------------------def agent_node(state: AgentState) -> dict:- """Invoke the LLM with the current message history."""- llm = build_llm()- messages = [SystemMessage(content=SYSTEM_PROMPT), *state["messages"]]- response = llm.invoke(messages)- return {"messages": [response]}---def tool_executor_node(state: AgentState) -> dict:- """Execute every tool call requested by the last AI message."""- last: AIMessage = state["messages"][-1]- tool_messages = []- for call in last.tool_calls:- fn = TOOL_MAP[call["name"]]- result = fn.invoke(call["args"])- tool_messages.append(- ToolMessage(content=str(result), tool_call_id=call["id"])- )- return {"messages": tool_messages}---def summarise_node(state: AgentState) -> dict:- """Extract the final assistant answer into the summary field."""- for msg in reversed(state["messages"]):- if isinstance(msg, AIMessage) and msg.content:- return {"summary": msg.content}- return {"summary": ""}---# ----------------------------------------------------------------------------# Routing-# -----------------------------------------------------------------------------def should_use_tools(state: AgentState) -> str:- """Route to tool executor if the last message has tool calls."""- last = state["messages"][-1]- if isinstance(last, AIMessage) and last.tool_calls:- return "tools"- return "summarise"---# ----------------------------------------------------------------------------# Build graph-# -----------------------------------------------------------------------------def build_graph() -> StateGraph:- graph = StateGraph(AgentState)-- graph.add_node("agent", agent_node)- graph.add_node("tools", tool_executor_node)- graph.add_node("summarise", summarise_node)-- graph.set_entry_point("agent")- graph.add_conditional_edges("agent", should_use_tools, {"tools": "tools", "summarise": "summarise"})- graph.add_edge("tools", "agent")- graph.add_edge("summarise", END)-- return graph.compile()---# ----------------------------------------------------------------------------# Main-# -----------------------------------------------------------------------------def main() -> None:- if not os.environ.get("OPENAI_API_KEY"):- raise SystemExit("Set OPENAI_API_KEY before running this script.")-- app = build_graph()-- print("Research Assistant (type 'quit' to exit)")- print("-" * 45)-- while True:- question = input("\nYou: ").strip()- if not question or question.lower() in {"quit", "exit", "q"}:- print("Goodbye!")- break-- result = app.invoke(- {"messages": [HumanMessage(content=question)], "search_results": [], "summary": ""},- )-- print(f"\nAssistant:\n{result['summary']}")---if __name__ == "__main__":- main()\ No newline at end of filediff --git a/examples/test_openai_app.py b/examples/test_openai_app.pydeleted file mode 100644index 2660ba5f..00000000--- a/examples/test_openai_app.py+++ /dev/null@@ -1,101 +0,0 @@-"""-Simple test app that calls OpenAI models via the openlit SDK.-Sends telemetry to a local OpenLIT instance.--Usage:- export OPENAI_API_KEY=sk-...- pip install openai openlit- python examples/test_openai_app.py-"""--import os-import time--import openai-import openlit--openlit.init(- otlp_endpoint="http://localhost:4318",- application_name="test-openai-app",-)--client = openai.OpenAI()---def chat_completion():- print("[1/3] Running chat completion (gpt-4o-mini)...")- resp = client.chat.completions.create(- model="gpt-4o-mini",- messages=[- {"role": "system", "content": "You are a helpful assistant."},- {"role": "user", "content": "What is eBPF and why is it useful for observability?"},- ],- max_tokens=200,- )- print(f" -> {resp.choices[0].message.content[:120]}...\n")- return resp---def chat_with_tools():- print("[2/3] Running chat completion with tool calling...")- tools = [- {- "type": "function",- "function": {- "name": "get_weather",- "description": "Get the current weather for a location",- "parameters": {- "type": "object",- "properties": {- "location": {"type": "string", "description": "City name"},- },- "required": ["location"],- },- },- }- ]- resp = client.chat.completions.create(- model="gpt-4o-mini",- messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],- tools=tools,- max_tokens=200,- )- if resp.choices[0].message.tool_calls:- print(f" -> Tool call: {resp.choices[0].message.tool_calls[0].function.name}"- f"({resp.choices[0].message.tool_calls[0].function.arguments})\n")- else:- print(f" -> {resp.choices[0].message.content[:120]}...\n")- return resp---def embeddings():- print("[3/3] Running embeddings (text-embedding-3-small)...")- resp = client.embeddings.create(- model="text-embedding-3-small",- input=["OpenLIT provides observability for LLM applications"],- )- print(f" -> Embedding dim: {len(resp.data[0].embedding)}\n")- return resp---def main():- if not os.environ.get("OPENAI_API_KEY"):- raise SystemExit("Set OPENAI_API_KEY before running this script.")-- print("=" * 60)- print("OpenLIT Test App -- Sending telemetry to http://localhost:4318")- print("=" * 60 + "\n")-- chat_completion()- time.sleep(1)- chat_with_tools()- time.sleep(1)- embeddings()-- print("=" * 60)- print("Done! Check OpenLIT at http://localhost:3000 to see traces.")- print("=" * 60)---if __name__ == "__main__":- main()diff --git a/examples/test_qdrant_compatibility.py b/examples/test_qdrant_compatibility.pydeleted file mode 100644index 1e8f4cb2..00000000--- a/examples/test_qdrant_compatibility.py+++ /dev/null@@ -1,68 +0,0 @@-"""-Test script to reproduce Issue #971 - Qdrant instrumentation failure with qdrant-client >= 1.16.0-"""--import sys--print("=" * 60)-print("Testing Qdrant Instrumentation Issue #971")-print("=" * 60)--# Check qdrant-client version-try:- import importlib.metadata-- qdrant_version = importlib.metadata.version("qdrant-client")- print(f"✓ qdrant-client version: {qdrant_version}")-except Exception as e:- print(f"✗ Cannot detect qdrant-client version: {e}")- sys.exit(1)--# Check if deprecated methods exist-try:- from qdrant_client import QdrantClient-- deprecated = ["search", "search_groups", "recommend"]- new_methods = ["query_points", "query_points_groups", "query_batch_points"]-- print(f"\nDeprecated methods availability:")- for method in deprecated:- has_method = hasattr(QdrantClient, method)- status = "✓" if has_method else "✗"- print(f" {status} {method}: {has_method}")-- print(f"\nNew methods availability:")- for method in new_methods:- has_method = hasattr(QdrantClient, method)- status = "✓" if has_method else "✗"- print(f" {status} {method}: {has_method}")--except Exception as e:- print(f"✗ Error checking QdrantClient methods: {e}")- sys.exit(1)--# Try to initialize OpenLIT-print(f"\n{'=' * 60}")-print("Attempting to initialize OpenLIT instrumentation...")-print("=" * 60)--try:- import openlit-- openlit.init(- otlp_endpoint="http://localhost:4318",- collect_gpu_stats=False,- disable_batch=True,- )- print("✓ OpenLIT instrumentation initialized successfully!")--except Exception as e:- print(f"✗ OpenLIT instrumentation FAILED: {e}")- import traceback-- traceback.print_exc()- sys.exit(1)--print(f"\n{'=' * 60}")-print("Test completed successfully!")-print("=" * 60)diff --git a/openlit-controller/cmd/controller/main.go b/openlit-controller/cmd/controller/main.goindex 6597f3c3..81c49c99 100644--- a/openlit-controller/cmd/controller/main.go+++ b/openlit-controller/cmd/controller/main.go@@ -264,6 +264,39 @@ func doPoll(pr.pollInterval = time.Duration(seconds) * time.Second}}++ if exportRaw, ok := resp.Config["export"]; ok {+ if exportMap, ok := exportRaw.(map[string]interface{}); ok {+ newCfg := eng.GetExportConfig()+ if v, ok := exportMap["otlp_endpoint"].(string); ok {+ newCfg.OTLPEndpoint = v+ }+ if v, ok := exportMap["otlp_protocol"].(string); ok {+ newCfg.OTLPProtocol = v+ }+ if v, ok := exportMap["otlp_traces_endpoint"].(string); ok {+ newCfg.OTLPTracesEndpoint = v+ }+ if v, ok := exportMap["otlp_metrics_endpoint"].(string); ok {+ newCfg.OTLPMetricsEndpoint = v+ }+ if v, ok := exportMap["otlp_logs_endpoint"].(string); ok {+ newCfg.OTLPLogsEndpoint = v+ }+ if headersRaw, ok := exportMap["otlp_headers"]; ok {+ if headersMap, ok := headersRaw.(map[string]interface{}); ok {+ headers := make(map[string]string, len(headersMap))+ for k, v := range headersMap {+ if sv, ok := v.(string); ok {+ headers[k] = sv+ }+ }+ newCfg.OTLPHeaders = headers+ }+ }+ eng.UpdateExportConfig(newCfg)+ }+ }}return prdiff --git a/openlit-controller/deploy/README.md b/openlit-controller/deploy/README.mddeleted file mode 100644index e2a962da..00000000--- a/openlit-controller/deploy/README.md+++ /dev/null@@ -1,59 +0,0 @@-# OpenLIT Controller — Deployment & Demos--Ready-to-run demos for every deployment mode. Each folder contains everything you need to get the controller running with sample LLM apps.--All images are **built from source** — no pre-built images are pulled from a registry. All demos use the same sample apps from `examples/` (OpenAI, Anthropic, Gemini, CrewAI) so behavior is consistent across platforms.--## Pick your platform--| Platform | Setup time | What you need |-|----------|-----------|---------------|-| [**Docker**](./docker/) | ~2 minutes | Docker + Docker Compose + full repo clone |-| [**Kubernetes**](./kubernetes/) | ~3 minutes | kubectl + a cluster + Docker + full repo clone |-| [**Linux**](./linux/) | ~3 minutes | Linux machine + Docker + Go + Python 3 |--## Docker (recommended for trying it out)--```bash-cd docker-docker compose up -d --build-# Open http://localhost:3000-```--[Full instructions →](./docker/README.md)--## Kubernetes--```bash-cd kubernetes-bash setup.sh-kubectl port-forward -n openlit svc/openlit 3000:3000-# Open http://localhost:3000-```--[Full instructions →](./kubernetes/README.md)--## Linux (bare metal)--```bash-cd linux-sudo bash setup.sh-# Open http://localhost:3000-```--[Full instructions →](./linux/README.md)--## Production deployment--For production use, we recommend the **Helm chart**:--```bash-helm repo add openlit https://openlit.github.io/helm-helm install openlit openlit/openlit --set openlit-controller.enabled=true-```--Or use the **install script** for bare-metal Linux:--```bash-curl -sSL https://get.openlit.io/controller | sudo bash-```diff --git a/openlit-controller/deploy/docker/README.md b/openlit-controller/deploy/docker/README.mddeleted file mode 100644index 2cef630d..00000000--- a/openlit-controller/deploy/docker/README.md+++ /dev/null@@ -1,96 +0,0 @@-# OpenLIT Controller — Docker Demo--Run the full OpenLIT stack with the Controller and sample LLM apps in Docker. All images are **built from source** — no pre-built images are pulled.--The sample apps are shared from the repo's `examples/` folder — the same apps used by all demos.--## What's included--| Service | Description |-|------------------------|-------------------------------------------------|-| **ClickHouse** | Time-series database for telemetry |-| **OpenLIT** | Dashboard + OTLP collector (port 3000) |-| **Controller** | eBPF-based LLM service discovery |-| **openai-chat-app** | Sample app calling OpenAI (from examples/) |-| **anthropic-chat-app** | Sample app calling Anthropic (from examples/) |-| **gemini-chat-app** | Sample app calling Gemini (from examples/) |-| **crewai-agent-app** | Sample CrewAI agent app (from examples/) |--## Prerequisites--- Docker Engine 20.10+ with Docker Compose v2-- Linux host (eBPF requires a Linux kernel — Docker Desktop on macOS/Windows runs a Linux VM, which works)-- **Full repo clone** (images are built from source)--## Quick Start--```bash-# 1. Start everything (builds all images from source)-docker compose up -d --build--# 2. Wait ~30 seconds for services to initialize, then open the dashboard-open http://localhost:3000-```--The Controller will automatically discover the sample apps making LLM API calls and show them on the **Agents** page.--## Check status--```bash-# View all containers-docker compose ps--# View controller logs-docker compose logs openlit-controller -f--# View a sample app's logs-docker compose logs openai-app -f-```--## Tear down--```bash-# Stop and remove all containers + networks-docker compose down--# Also remove stored data (ClickHouse + OpenLIT)-docker compose down -v-```--## Configuration--### Use your own API keys--Edit the `docker-compose.yaml` and replace `demo-key` with real keys:--```yaml-openai-app:- environment:- OPENAI_API_KEY: "sk-your-real-key"-```--### Secure with an API Key--1. Open the dashboard at `http://localhost:3000`-2. Go to **Settings → API Keys** and create a key-3. Add it to the controller in `docker-compose.yaml`:--```yaml-openlit-controller:- environment:- OPENLIT_API_KEY: "your-api-key"-```--4. Restart: `docker compose up -d openlit-controller`--### Controller Identity--The controller automatically derives a stable identity from the Docker host's hostname (via the already-mounted `/proc`). This means `docker restart` and `docker stop && start` preserve the same controller entry on the Agents page.--If you need a fully custom identity (e.g., multiple controllers on the same host), set `OPENLIT_INSTANCE_ID`:--```yaml-openlit-controller:- environment:- OPENLIT_INSTANCE_ID: "my-docker-controller-1"-```diff --git a/openlit-controller/deploy/docker/docker-compose.yaml b/openlit-controller/deploy/docker/docker-compose.yamldeleted file mode 100644index 94e575a5..00000000--- a/openlit-controller/deploy/docker/docker-compose.yaml+++ /dev/null@@ -1,117 +0,0 @@-services:- # --- Infrastructure ---- clickhouse:- image: clickhouse/clickhouse-server:24.4.1- container_name: openlit-clickhouse- environment:- CLICKHOUSE_PASSWORD: OPENLIT- CLICKHOUSE_USER: default- CLICKHOUSE_DATABASE: openlit- volumes:- - clickhouse-data:/var/lib/clickhouse- ports:- - "8123:8123"- healthcheck:- test: ["CMD-SHELL", "clickhouse-client --user=default --password=OPENLIT --query='SELECT 1' || exit 1"]- interval: 5s- timeout: 3s- retries: 10- start_period: 60s- restart: always-- openlit:- image: openlit:local- build:- context: ../../../src- dockerfile: Dockerfile- container_name: openlit- environment:- INIT_DB_HOST: clickhouse- INIT_DB_PORT: "8123"- INIT_DB_DATABASE: openlit- INIT_DB_USERNAME: default- INIT_DB_PASSWORD: OPENLIT- SQLITE_DATABASE_URL: file:/app/client/data/data.db- ports:- - "3000:3000"- - "4318:4318"- depends_on:- clickhouse:- condition: service_healthy- volumes:- - openlit-data:/app/client/data- healthcheck:- test: ["CMD", "node", "-e", "fetch('http://localhost:3000').then(r=>{process.exit(r.ok?0:1)}).catch(()=>process.exit(1))"]- interval: 5s- timeout: 5s- retries: 10- start_period: 30s- restart: always-- # --- OpenLIT Controller ---- openlit-controller:- image: openlit-controller:local- build:- context: ../../- dockerfile: Dockerfile- container_name: openlit-controller- privileged: true- pid: host- environment:- OPENLIT_URL: http://openlit:3000- OTEL_EXPORTER_OTLP_ENDPOINT: http://openlit:4318- OPENLIT_PROC_ROOT: /host/proc- volumes:- - /proc:/host/proc:ro- - /sys/kernel/debug:/sys/kernel/debug:ro- - /sys/fs/bpf:/sys/fs/bpf:rw- - /var/run/docker.sock:/var/run/docker.sock:rw- depends_on:- openlit:- condition: service_healthy- restart: always-- # --- Sample Apps (built from examples/) ---- openai-app:- build: ../../../examples/openai-chat-app- container_name: demo-openai-app- environment:- OPENAI_API_KEY: "demo-key"- restart: unless-stopped- depends_on:- openlit:- condition: service_healthy-- anthropic-app:- build: ../../../examples/anthropic-chat-app- container_name: demo-anthropic-app- environment:- ANTHROPIC_API_KEY: "demo-key"- restart: unless-stopped- depends_on:- openlit:- condition: service_healthy-- gemini-app:- build: ../../../examples/gemini-chat-app- container_name: demo-gemini-app- environment:- GEMINI_API_KEY: "demo-key"- restart: unless-stopped- depends_on:- openlit:- condition: service_healthy-- crewai-app:- build: ../../../examples/crewai-agent-app- container_name: demo-crewai-app- environment:- OPENAI_API_KEY: "demo-key"- restart: unless-stopped- depends_on:- openlit:- condition: service_healthy--volumes:- clickhouse-data:- openlit-data:diff --git a/openlit-controller/deploy/install.sh b/openlit-controller/deploy/install.shdeleted file mode 100755index 45ff8619..00000000--- a/openlit-controller/deploy/install.sh+++ /dev/null@@ -1,117 +0,0 @@-#!/bin/bash-set -euo pipefail--# OpenLIT Controller installer-# Usage: curl -sSL https://get.openlit.io/controller | sudo bash--REPO="openlit/openlit"-BINARY="openlit-controller"-INSTALL_DIR="/usr/local/bin"-CONFIG_DIR="/etc/openlit-controller"-SERVICE_FILE="/etc/systemd/system/openlit-controller.service"--RED='\033[0;31m'-GREEN='\033[0;32m'-YELLOW='\033[1;33m'-NC='\033[0m'--info() { echo -e "${GREEN}[INFO]${NC} $*"; }-warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }-error() { echo -e "${RED}[ERROR]${NC} $*"; exit 1; }--if [ "$(id -u)" -ne 0 ]; then- error "This script must be run as root (use sudo)"-fi--ARCH=$(uname -m)-case "$ARCH" in- x86_64) ARCH="amd64" ;;- aarch64) ARCH="arm64" ;;- arm64) ARCH="arm64" ;;- *) error "Unsupported architecture: $ARCH" ;;-esac--OS=$(uname -s | tr '[:upper:]' '[:lower:]')-if [ "$OS" != "linux" ]; then- error "Unsupported OS: $OS (only Linux is supported)"-fi--info "Detecting latest release..."-LATEST=$(curl -sSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | head -1 | cut -d'"' -f4)-if [ -z "$LATEST" ]; then- warn "Could not detect latest release, using 'latest'"- LATEST="latest"-fi--DOWNLOAD_URL="https://github.com/${REPO}/releases/download/${LATEST}/${BINARY}-linux-${ARCH}.tar.gz"--info "Downloading ${BINARY} ${LATEST} for linux/${ARCH}..."-TMP_DIR=$(mktemp -d)-trap "rm -rf $TMP_DIR" EXIT--curl -sSL "$DOWNLOAD_URL" -o "$TMP_DIR/${BINARY}.tar.gz"-tar -xzf "$TMP_DIR/${BINARY}.tar.gz" -C "$TMP_DIR"--info "Installing to ${INSTALL_DIR}/${BINARY}..."-install -m 0755 "$TMP_DIR/${BINARY}-linux-${ARCH}" "${INSTALL_DIR}/${BINARY}"--info "Creating config directory..."-mkdir -p "$CONFIG_DIR"--if [ ! -f "${CONFIG_DIR}/config.yaml" ]; then- cat > "${CONFIG_DIR}/config.yaml" <<'EOF'-# OpenLIT Controller Config-# The only required setting:-openlit_url: "http://localhost:3000"--# Optional: API key for authentication-# api_key: ""--# Optional: listen address for controller REST API-# api_listen: ":4321"-EOF- info "Created default config at ${CONFIG_DIR}/config.yaml"- warn "Edit ${CONFIG_DIR}/config.yaml to set your OpenLIT URL"-fi--if [ ! -f "${CONFIG_DIR}/env" ]; then- cat > "${CONFIG_DIR}/env" <<'EOF'-# Environment overrides for openlit-controller-# OPENLIT_URL=http://localhost:3000-# OPENLIT_API_KEY=-EOF-fi--if command -v systemctl >/dev/null 2>&1; then- info "Installing systemd service..."- cat > "$SERVICE_FILE" <<'EOF'-[Unit]-Description=OpenLIT Controller - LLM Observability via eBPF-After=network.target--[Service]-Type=simple-ExecStart=/usr/local/bin/openlit-controller --config /etc/openlit-controller/config.yaml-EnvironmentFile=-/etc/openlit-controller/env-Restart=always-RestartSec=5-AmbientCapabilities=CAP_BPF CAP_SYS_PTRACE CAP_NET_RAW CAP_PERFMON CAP_DAC_READ_SEARCH CAP_CHECKPOINT_RESTORE--[Install]-WantedBy=multi-user.target-EOF-- systemctl daemon-reload- systemctl enable openlit-controller- info "Service installed. Start with: sudo systemctl start openlit-controller"-else- warn "systemd not found. Run manually: sudo ${INSTALL_DIR}/${BINARY} --config ${CONFIG_DIR}/config.yaml"-fi--info "Installation complete!"-echo ""-echo "Next steps:"-echo " 1. Edit ${CONFIG_DIR}/config.yaml and set openlit_url to your OpenLIT dashboard"-echo " 2. Start the controller: sudo systemctl start openlit-controller"-echo " 3. Check status: sudo systemctl status openlit-controller"-echo ""diff --git a/openlit-controller/deploy/kubernetes/README.md b/openlit-controller/deploy/kubernetes/README.mddeleted file mode 100644index 198ce2e4..00000000--- a/openlit-controller/deploy/kubernetes/README.md+++ /dev/null@@ -1,116 +0,0 @@-# OpenLIT Controller — Kubernetes Demo--Deploy the full OpenLIT stack with the Controller and sample LLM apps on any Kubernetes cluster. All images are **built from source** and loaded into the cluster automatically.--The sample apps are the same ones from the repo's `examples/` folder, packaged as container images.--## What's included--| Resource | Kind | Description |-|-------------------------|-------------|---------------------------------------------------|-| **ClickHouse** | StatefulSet | Time-series database for telemetry |-| **OpenLIT** | Deployment | Dashboard + OTLP collector |-| **OpenLIT Controller** | DaemonSet | eBPF-based LLM service discovery |-| **demo-openai-app** | Deployment | Sample app calling OpenAI (from examples/) |-| **demo-anthropic-app** | Deployment | Sample app calling Anthropic (from examples/) |-| **demo-gemini-app** | Deployment | Sample app calling Gemini (from examples/) |-| **demo-crewai-app** | Deployment | Sample CrewAI agent app (from examples/) |--## Prerequisites--- A Kubernetes cluster (minikube, kind, k3d, EKS, GKE, etc.)-- `kubectl` configured and pointing to your cluster-- `docker` (images are built from source)-- The cluster nodes must run Linux with kernel 5.8+ (for eBPF)-- **Full repo clone** (images are built from `src/`, `openlit-controller/`, and `examples/`)--## Quick Start--```bash-# 1. Run the setup script (builds images + deploys everything)-bash setup.sh--# 2. Forward the dashboard port to your machine-kubectl port-forward -n openlit svc/openlit 3000:3000--# 3. Open the dashboard-open http://localhost:3000-```--The setup script will:-1. Build all images from source (OpenLIT, controller, sample apps)-2. Auto-detect your cluster (k3d, kind, or minikube) and load images-3. Deploy ClickHouse, OpenLIT, the controller, and sample apps--The Controller runs as a DaemonSet on every node and automatically discovers the sample apps making LLM API calls. Check the **Agents** page in the dashboard.--## Check status--```bash-# All pods-kubectl get pods -n openlit--# Controller logs-kubectl logs -n openlit -l app=openlit-controller -f--# Dashboard logs-kubectl logs -n openlit -l app=openlit -f-```--## Tear down--```bash-bash teardown.sh-```--This removes all resources including the namespace. No cluster-level changes remain.--## Configuration--### Use your own API keys--Edit `sample-apps.yaml` and replace `demo-key` with real keys:--```yaml-env:- - name: OPENAI_API_KEY- value: "sk-your-real-key"-```--Then re-apply: `kubectl apply -f sample-apps.yaml`--### Secure with an API Key--1. Open the dashboard and go to **Settings → API Keys**-2. Create an API key-3. Edit `configmap.yaml` and add:--```yaml-data:- config.yaml: |- openlit_url: "http://openlit.openlit.svc.cluster.local:3000"- api_key: "your-api-key"-```--4. Re-apply: `kubectl apply -f configmap.yaml && kubectl rollout restart daemonset/openlit-controller -n openlit`--### Use Helm instead--### Controller Identity--The controller uses `NODE_NAME` (set via the Kubernetes downward API in the DaemonSet spec) as its identity. This is stable across pod restarts on the same node. To override it, set `OPENLIT_INSTANCE_ID` in the DaemonSet env:--```yaml-env:- - name: OPENLIT_INSTANCE_ID- value: "my-k8s-controller"-```--### Use Helm instead--For production deployments, use the Helm chart:--```bash-helm repo add openlit https://openlit.github.io/helm-helm install openlit openlit/openlit --set openlit-controller.enabled=true-```diff --git a/openlit-controller/deploy/kubernetes/clusterrole.yaml b/openlit-controller/deploy/kubernetes/clusterrole.yamldeleted file mode 100644index 4dfa7024..00000000--- a/openlit-controller/deploy/kubernetes/clusterrole.yaml+++ /dev/null@@ -1,11 +0,0 @@-apiVersion: rbac.authorization.k8s.io/v1-kind: ClusterRole-metadata:- name: openlit-controller-rules:- - apiGroups: [""]- resources: [pods, nodes, namespaces, services, replicationcontrollers]- verbs: [get, list, watch]- - apiGroups: [apps]- resources: [deployments, replicasets, statefulsets, daemonsets]- verbs: [get, list, watch, patch]diff --git a/openlit-controller/deploy/kubernetes/clusterrolebinding.yaml b/openlit-controller/deploy/kubernetes/clusterrolebinding.yamldeleted file mode 100644index b488fde6..00000000--- a/openlit-controller/deploy/kubernetes/clusterrolebinding.yaml+++ /dev/null@@ -1,12 +0,0 @@-apiVersion: rbac.authorization.k8s.io/v1-kind: ClusterRoleBinding-metadata:- name: openlit-controller-roleRef:- apiGroup: rbac.authorization.k8s.io- kind: ClusterRole- name: openlit-controller-subjects:- - kind: ServiceAccount- name: openlit-controller- namespace: openlitdiff --git a/openlit-controller/deploy/kubernetes/configmap.yaml b/openlit-controller/deploy/kubernetes/configmap.yamldeleted file mode 100644index 902c2ecf..00000000--- a/openlit-controller/deploy/kubernetes/configmap.yaml+++ /dev/null@@ -1,11 +0,0 @@-apiVersion: v1-kind: ConfigMap-metadata:- name: openlit-controller-config- namespace: openlit-data:- config.yaml: |- openlit_url: "http://openlit.openlit.svc.cluster.local:3000"- obi_binary_path: "/usr/local/bin/obi"- otlp_endpoint: "http://otel-collector.openlit.svc.cluster.local:4318"- poll_interval: 60sdiff --git a/openlit-controller/deploy/kubernetes/daemonset.yaml b/openlit-controller/deploy/kubernetes/daemonset.yamldeleted file mode 100644index 85dce608..00000000--- a/openlit-controller/deploy/kubernetes/daemonset.yaml+++ /dev/null@@ -1,83 +0,0 @@-apiVersion: apps/v1-kind: DaemonSet-metadata:- name: openlit-controller- namespace: openlit- labels:- app: openlit-controller-spec:- selector:- matchLabels:- app: openlit-controller- template:- metadata:- labels:- app: openlit-controller- spec:- serviceAccountName: openlit-controller- hostPID: true- containers:- - name: controller- image: openlit-controller:local- imagePullPolicy: IfNotPresent- args: ["--config", "/etc/openlit-controller/config.yaml"]- env:- - name: OPENLIT_PROC_ROOT- value: "/host/proc"- - name: NODE_NAME- valueFrom:- fieldRef:- fieldPath: spec.nodeName- - name: POD_NAME- valueFrom:- fieldRef:- fieldPath: metadata.name- - name: POD_NAMESPACE- valueFrom:- fieldRef:- fieldPath: metadata.namespace- - name: POD_UID- valueFrom:- fieldRef:- fieldPath: metadata.uid- - name: OPENLIT_CLUSTER_ID- value: "default"- securityContext:- privileged: true- volumeMounts:- - name: proc- mountPath: /host/proc- readOnly: true- - name: sys-kernel-debug- mountPath: /sys/kernel/debug- readOnly: true- - name: bpf- mountPath: /sys/fs/bpf- - name: config- mountPath: /etc/openlit-controller- readOnly: true- resources:- requests:- cpu: 100m- memory: 128Mi- limits:- cpu: 500m- memory: 512Mi- volumes:- - name: proc- hostPath:- path: /proc- - name: sys-kernel-debug- hostPath:- path: /sys/kernel/debug- - name: bpf- hostPath:- path: /sys/fs/bpf- - name: config- configMap:- name: openlit-controller-config- tolerations:- - effect: NoSchedule- operator: Exists- - effect: NoExecute- operator: Existsdiff --git a/openlit-controller/deploy/kubernetes/namespace.yaml b/openlit-controller/deploy/kubernetes/namespace.yamldeleted file mode 100644index 960b20b1..00000000--- a/openlit-controller/deploy/kubernetes/namespace.yaml+++ /dev/null@@ -1,4 +0,0 @@-apiVersion: v1-kind: Namespace-metadata:- name: openlitdiff --git a/openlit-controller/deploy/kubernetes/openlit.yaml b/openlit-controller/deploy/kubernetes/openlit.yamldeleted file mode 100644index 3d35e996..00000000--- a/openlit-controller/deploy/kubernetes/openlit.yaml+++ /dev/null@@ -1,110 +0,0 @@-apiVersion: apps/v1-kind: StatefulSet-metadata:- name: clickhouse- namespace: openlit-spec:- serviceName: clickhouse- replicas: 1- selector:- matchLabels:- app: clickhouse- template:- metadata:- labels:- app: clickhouse- spec:- containers:- - name: clickhouse- image: clickhouse/clickhouse-server:24.4.1- env:- - name: CLICKHOUSE_PASSWORD- value: OPENLIT- - name: CLICKHOUSE_USER- value: default- - name: CLICKHOUSE_DATABASE- value: openlit- ports:- - containerPort: 8123- - containerPort: 9000- volumeMounts:- - name: data- mountPath: /var/lib/clickhouse- volumeClaimTemplates:- - metadata:- name: data- spec:- accessModes: [ReadWriteOnce]- resources:- requests:- storage: 5Gi-----apiVersion: v1-kind: Service-metadata:- name: clickhouse- namespace: openlit-spec:- selector:- app: clickhouse- ports:- - name: http- port: 8123- - name: native- port: 9000-----apiVersion: apps/v1-kind: Deployment-metadata:- name: openlit- namespace: openlit-spec:- replicas: 1- selector:- matchLabels:- app: openlit- template:- metadata:- labels:- app: openlit- spec:- containers:- - name: openlit- image: openlit:local- imagePullPolicy: IfNotPresent- env:- - name: INIT_DB_HOST- value: clickhouse- - name: INIT_DB_PORT- value: "8123"- - name: INIT_DB_DATABASE- value: openlit- - name: INIT_DB_USERNAME- value: default- - name: INIT_DB_PASSWORD- value: OPENLIT- - name: SQLITE_DATABASE_URL- value: file:/app/client/data/data.db- ports:- - containerPort: 3000- - containerPort: 4318- volumeMounts:- - name: data- mountPath: /app/client/data- volumes:- - name: data- emptyDir: {}-----apiVersion: v1-kind: Service-metadata:- name: openlit- namespace: openlit-spec:- selector:- app: openlit- ports:- - name: ui- port: 3000- - name: otlp-http- port: 4318diff --git a/openlit-controller/deploy/kubernetes/sample-apps.yaml b/openlit-controller/deploy/kubernetes/sample-apps.yamldeleted file mode 100644index b03fc450..00000000--- a/openlit-controller/deploy/kubernetes/sample-apps.yaml+++ /dev/null@@ -1,99 +0,0 @@-apiVersion: apps/v1-kind: Deployment-metadata:- name: demo-openai-app- namespace: openlit- labels:- app: demo-openai-app-spec:- replicas: 1- selector:- matchLabels:- app: demo-openai-app- template:- metadata:- labels:- app: demo-openai-app- spec:- containers:- - name: app- image: demo-openai-app:local- imagePullPolicy: IfNotPresent- env:- - name: OPENAI_API_KEY- value: "demo-key"-----apiVersion: apps/v1-kind: Deployment-metadata:- name: demo-anthropic-app- namespace: openlit- labels:- app: demo-anthropic-app-spec:- replicas: 1- selector:- matchLabels:- app: demo-anthropic-app- template:- metadata:- labels:- app: demo-anthropic-app- spec:- containers:- - name: app- image: demo-anthropic-app:local- imagePullPolicy: IfNotPresent- env:- - name: ANTHROPIC_API_KEY- value: "demo-key"-----apiVersion: apps/v1-kind: Deployment-metadata:- name: demo-gemini-app- namespace: openlit- labels:- app: demo-gemini-app-spec:- replicas: 1- selector:- matchLabels:- app: demo-gemini-app- template:- metadata:- labels:- app: demo-gemini-app- spec:- containers:- - name: app- image: demo-gemini-app:local- imagePullPolicy: IfNotPresent- env:- - name: GEMINI_API_KEY- value: "demo-key"-----apiVersion: apps/v1-kind: Deployment-metadata:- name: demo-crewai-app- namespace: openlit- labels:- app: demo-crewai-app-spec:- replicas: 1- selector:- matchLabels:- app: demo-crewai-app- template:- metadata:- labels:- app: demo-crewai-app- spec:- containers:- - name: app- image: demo-crewai-app:local- imagePullPolicy: IfNotPresent- env:- - name: OPENAI_API_KEY- value: "demo-key"diff --git a/openlit-controller/deploy/kubernetes/serviceaccount.yaml b/openlit-controller/deploy/kubernetes/serviceaccount.yamldeleted file mode 100644index 2912d8e4..00000000--- a/openlit-controller/deploy/kubernetes/serviceaccount.yaml+++ /dev/null@@ -1,5 +0,0 @@-apiVersion: v1-kind: ServiceAccount-metadata:- name: openlit-controller- namespace: openlitdiff --git a/openlit-controller/deploy/kubernetes/setup.sh b/openlit-controller/deploy/kubernetes/setup.shdeleted file mode 100755index 9f802566..00000000--- a/openlit-controller/deploy/kubernetes/setup.sh+++ /dev/null@@ -1,118 +0,0 @@-#!/bin/bash-set -euo pipefail--GREEN='\033[0;32m'-YELLOW='\033[1;33m'-RED='\033[0;31m'-NC='\033[0m'-info() { echo -e "${GREEN}[✓]${NC} $*"; }-step() { echo -e "\n${YELLOW}→${NC} $*"; }-error() { echo -e "${RED}[✗]${NC} $*"; exit 1; }--SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"-REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"--for cmd in docker kubectl; do- if ! command -v "$cmd" &>/dev/null; then- error "'$cmd' is required but not installed."- fi-done--# --- Step 1: Build images from source ----step "Building images from source"--echo " Building OpenLIT Dashboard..."-docker build -t openlit:local "$REPO_ROOT/src"--echo " Building OpenLIT Controller..."-docker build -t openlit-controller:local "$REPO_ROOT/openlit-controller"--echo " Building sample apps..."-docker build -t demo-openai-app:local "$REPO_ROOT/examples/openai-chat-app" --quiet-docker build -t demo-anthropic-app:local "$REPO_ROOT/examples/anthropic-chat-app" --quiet-docker build -t demo-gemini-app:local "$REPO_ROOT/examples/gemini-chat-app" --quiet-docker build -t demo-crewai-app:local "$REPO_ROOT/examples/crewai-agent-app" --quiet-info "All images built"--# --- Step 2: Load images into cluster (auto-detect environment) ----step "Loading images into cluster"--load_images() {- local images="openlit:local openlit-controller:local demo-openai-app:local demo-anthropic-app:local demo-gemini-app:local demo-crewai-app:local"-- if command -v k3d &>/dev/null; then- local cluster="${K3D_CLUSTER:-$(k3d cluster list -o json 2>/dev/null | grep -o '"name":"[^"]*"' | head -1 | cut -d'"' -f4)}"- if [ -n "$cluster" ]; then- echo " Detected k3d cluster: $cluster"- k3d image import $images -c "$cluster"- return 0- fi- fi-- if command -v kind &>/dev/null; then- local cluster="${KIND_CLUSTER:-$(kind get clusters 2>/dev/null | head -1)}"- if [ -n "$cluster" ]; then- echo " Detected kind cluster: $cluster"- for img in $images; do- kind load docker-image "$img" --name "$cluster"- done- return 0- fi- fi-- if command -v minikube &>/dev/null && minikube status &>/dev/null; then- echo " Detected minikube"- for img in $images; do- minikube image load "$img"- done- return 0- fi-- echo " No local cluster tool (k3d/kind/minikube) detected."- echo " Images are built locally. Push them to your registry or load them manually."- return 0-}--load_images-info "Images ready"--# --- Step 3: Deploy infrastructure ----step "Creating namespace"-kubectl apply -f "$SCRIPT_DIR/namespace.yaml"--step "Deploying ClickHouse + OpenLIT dashboard"-kubectl apply -f "$SCRIPT_DIR/openlit.yaml"--step "Waiting for OpenLIT to be ready (this may take 1-2 minutes)..."-kubectl rollout status deployment/openlit -n openlit --timeout=120s 2>/dev/null || true-sleep 10--# --- Step 4: Deploy controller ----step "Setting up RBAC for the controller"-kubectl apply -f "$SCRIPT_DIR/serviceaccount.yaml"-kubectl apply -f "$SCRIPT_DIR/clusterrole.yaml"-kubectl apply -f "$SCRIPT_DIR/clusterrolebinding.yaml"--step "Deploying controller config"-kubectl apply -f "$SCRIPT_DIR/configmap.yaml"--step "Deploying the OpenLIT Controller (DaemonSet)"-kubectl apply -f "$SCRIPT_DIR/daemonset.yaml"--# --- Step 5: Deploy sample apps ----step "Deploying sample LLM apps"-kubectl apply -f "$SCRIPT_DIR/sample-apps.yaml"--step "Waiting for pods..."-sleep 5-kubectl get pods -n openlit--info "Setup complete!"-echo ""-echo " Dashboard: kubectl port-forward -n openlit svc/openlit 3000:3000"-echo " then open http://localhost:3000"-echo ""-echo " Logs: kubectl logs -n openlit -l app=openlit-controller -f"-echo ""-echo " Tear down: bash $(basename "$SCRIPT_DIR")/teardown.sh"-echo ""diff --git a/openlit-controller/deploy/kubernetes/teardown.sh b/openlit-controller/deploy/kubernetes/teardown.shdeleted file mode 100755index 550eef14..00000000--- a/openlit-controller/deploy/kubernetes/teardown.sh+++ /dev/null@@ -1,30 +0,0 @@-#!/bin/bash-set -euo pipefail--RED='\033[0;31m'-GREEN='\033[0;32m'-NC='\033[0m'-info() { echo -e "${GREEN}[✓]${NC} $*"; }-step() { echo -e "\n${RED}→${NC} $*"; }--SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"--step "Removing sample apps"-kubectl delete -f "$SCRIPT_DIR/sample-apps.yaml" --ignore-not-found--step "Removing controller"-kubectl delete -f "$SCRIPT_DIR/daemonset.yaml" --ignore-not-found-kubectl delete -f "$SCRIPT_DIR/configmap.yaml" --ignore-not-found--step "Removing RBAC"-kubectl delete -f "$SCRIPT_DIR/clusterrolebinding.yaml" --ignore-not-found-kubectl delete -f "$SCRIPT_DIR/clusterrole.yaml" --ignore-not-found-kubectl delete -f "$SCRIPT_DIR/serviceaccount.yaml" --ignore-not-found--step "Removing OpenLIT + ClickHouse"-kubectl delete -f "$SCRIPT_DIR/openlit.yaml" --ignore-not-found--step "Removing namespace"-kubectl delete -f "$SCRIPT_DIR/namespace.yaml" --ignore-not-found--info "Teardown complete. All resources removed."diff --git a/openlit-controller/deploy/linux/README.md b/openlit-controller/deploy/linux/README.mddeleted file mode 100644index 820307f5..00000000--- a/openlit-controller/deploy/linux/README.md+++ /dev/null@@ -1,117 +0,0 @@-# OpenLIT Controller — Linux Demo--Run the OpenLIT Controller natively on a Linux machine with sample LLM apps. All components are **built from source** — the controller is compiled with Go and the OpenLIT Docker image is built locally.--The infrastructure (ClickHouse + OpenLIT dashboard) runs in Docker, while the controller and apps run directly on the host.--The sample apps are shared from the repo's `examples/` folder — the same apps used by all demos.--## What's included--| Component | Runs on | Description |-|------------------------|----------|-------------------------------------------|-| **ClickHouse** | Docker | Time-series database for telemetry |-| **OpenLIT** | Docker | Dashboard + OTLP collector (port 3000) |-| **Controller** | Host | eBPF-based LLM service discovery |-| **openai-chat-app** | Host | Sample app calling OpenAI (from examples/)|-| **anthropic-chat-app** | Host | Sample app calling Anthropic (from examples/)|-| **gemini-chat-app** | Host | Sample app calling Gemini (from examples/)|-| **crewai-agent-app** | Host | Sample CrewAI agent app (from examples/) |--## Prerequisites--- **Linux** machine with kernel 5.8+ (Ubuntu 22.04+, Debian 12+, Fedora 37+)-- **Docker** with Docker Compose v2 (for ClickHouse + OpenLIT)-- **Go 1.24+** (to build the controller from source)-- **Python 3.8+** with pip-- **Root access** (the controller needs eBPF capabilities)-- **Full repo clone** (everything is built from source)--## Quick Start--```bash-# 1. Run setup (builds everything from source, starts all services)-sudo bash setup.sh--# 2. Open the dashboard-open http://localhost:3000-```--The setup script will:-1. Build the OpenLIT Docker image from source-2. Start ClickHouse + OpenLIT in Docker-3. Build the controller binary from source (Go)-4. Start the controller (connects to the dashboard automatically)-5. Start 4 sample Python apps that call OpenAI, Anthropic, Gemini, and CrewAI--Within ~30 seconds, the controller discovers the apps and they appear in the **Agents** page.--## Check status--```bash-# Dashboard infrastructure-docker compose ps--# Controller process-ps aux | grep openlit-controller--# Sample app processes-ps aux | grep "app.py"--# Controller logs (runs in foreground — check terminal or journal)-sudo journalctl -u openlit-controller -f # if using systemd-```--## Tear down--```bash-sudo bash teardown.sh-```--This stops all processes and removes the Docker containers + volumes. To also uninstall the controller binary:--```bash-sudo rm /usr/local/bin/openlit-controller-```--## Configuration--### Use your own API keys--Set environment variables before running setup:--```bash-export OPENAI_API_KEY="sk-your-real-key"-export ANTHROPIC_API_KEY="sk-ant-your-real-key"-export GEMINI_API_KEY="your-gemini-key"-sudo -E bash setup.sh-```--### Secure with an API Key--1. Open the dashboard at `http://localhost:3000`-2. Go to **Settings → API Keys** and create a key-3. Restart the controller with the key:--```bash-sudo OPENLIT_URL=http://127.0.0.1:3000 \- OPENLIT_API_KEY="your-api-key" \- OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 \- openlit-controller-```--### Install as a systemd service (production)--```bash-sudo curl -sSL https://get.openlit.io/controller | sudo bash-```--This installs the controller as a persistent systemd service. See `../install.sh` for details.--### Controller Identity--The controller uses the machine's hostname as its identity. This is stable across restarts. To override it, set `OPENLIT_INSTANCE_ID`:--```bash-OPENLIT_INSTANCE_ID="my-linux-controller" openlit-controller-```diff --git a/openlit-controller/deploy/linux/docker-compose.yaml b/openlit-controller/deploy/linux/docker-compose.yamldeleted file mode 100644index 1f351122..00000000--- a/openlit-controller/deploy/linux/docker-compose.yaml+++ /dev/null@@ -1,53 +0,0 @@-# Infrastructure only — the controller and sample apps run on the host-services:- clickhouse:- image: clickhouse/clickhouse-server:24.4.1- container_name: openlit-clickhouse- environment:- CLICKHOUSE_PASSWORD: OPENLIT- CLICKHOUSE_USER: default- CLICKHOUSE_DATABASE: openlit- volumes:- - clickhouse-data:/var/lib/clickhouse- ports:- - "8123:8123"- healthcheck:- test: ["CMD-SHELL", "clickhouse-client --user=default --password=OPENLIT --query='SELECT 1' || exit 1"]- interval: 5s- timeout: 3s- retries: 10- start_period: 60s- restart: always-- openlit:- image: openlit:local- build:- context: ../../../src- dockerfile: Dockerfile- container_name: openlit- environment:- INIT_DB_HOST: clickhouse- INIT_DB_PORT: "8123"- INIT_DB_DATABASE: openlit- INIT_DB_USERNAME: default- INIT_DB_PASSWORD: OPENLIT- SQLITE_DATABASE_URL: file:/app/client/data/data.db- ports:- - "3000:3000"- - "4318:4318"- depends_on:- clickhouse:- condition: service_healthy- volumes:- - openlit-data:/app/client/data- healthcheck:- test: ["CMD", "node", "-e", "fetch('http://localhost:3000').then(r=>{process.exit(r.ok?0:1)}).catch(()=>process.exit(1))"]- interval: 5s- timeout: 5s- retries: 10- start_period: 30s- restart: always--volumes:- clickhouse-data:- openlit-data:diff --git a/openlit-controller/deploy/linux/setup.sh b/openlit-controller/deploy/linux/setup.shdeleted file mode 100755index 699ff42a..00000000--- a/openlit-controller/deploy/linux/setup.sh+++ /dev/null@@ -1,120 +0,0 @@-#!/bin/bash-set -euo pipefail--GREEN='\033[0;32m'-YELLOW='\033[1;33m'-RED='\033[0;31m'-NC='\033[0m'-info() { echo -e "${GREEN}[✓]${NC} $*"; }-step() { echo -e "\n${YELLOW}→${NC} $*"; }-error() { echo -e "${RED}[✗]${NC} $*"; exit 1; }--SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"-REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"-EXAMPLES_DIR="$REPO_ROOT/examples"-PIDS_FILE="$SCRIPT_DIR/.demo-pids"--# --- Pre-flight checks ----if [ "$(uname -s)" != "Linux" ]; then- error "This demo requires Linux (eBPF). You're on $(uname -s)."-fi--if ! command -v docker >/dev/null 2>&1; then- error "Docker is required for ClickHouse + OpenLIT. Install: https://docs.docker.com/engine/install/"-fi--if ! command -v python3 >/dev/null 2>&1; then- error "Python 3 is required for the sample apps. Install: sudo apt install python3 python3-pip"-fi--if ! command -v go >/dev/null 2>&1; then- error "Go is required to build the controller from source. Install: https://go.dev/doc/install"-fi--if [ ! -d "$EXAMPLES_DIR/openai-chat-app" ]; then- error "Example apps not found at $EXAMPLES_DIR. Make sure you're running from a full repo clone."-fi--# --- Step 1: Build OpenLIT Docker image from source ----step "Building OpenLIT Docker image from source"-docker build -t openlit:local "$REPO_ROOT/src"-info "OpenLIT image built"--# --- Step 2: Infrastructure ----step "Starting ClickHouse + OpenLIT dashboard (Docker)"-cd "$SCRIPT_DIR"-docker compose up -d --build-info "Waiting for OpenLIT to become healthy..."-for i in $(seq 1 60); do- if curl -sf http://localhost:3000 > /dev/null 2>&1; then- info "OpenLIT is ready at http://localhost:3000"- break- fi- if [ "$i" -eq 60 ]; then- error "OpenLIT did not become healthy in time. Check: docker compose logs openlit"- fi- sleep 2-done--# --- Step 3: Build controller from source ----step "Building OpenLIT Controller from source"-CONTROLLER_DIR="$REPO_ROOT/openlit-controller"-CONTROLLER_BIN="$CONTROLLER_DIR/openlit-controller"--cd "$CONTROLLER_DIR"-make setup-bpf generate 2>/dev/null || true-CGO_ENABLED=0 go build -o "$CONTROLLER_BIN" ./cmd/controller-sudo install -m 0755 "$CONTROLLER_BIN" /usr/local/bin/openlit-controller-rm -f "$CONTROLLER_BIN"-info "Controller built and installed at /usr/local/bin/openlit-controller"--# --- Step 4: Start controller ----step "Starting controller (background)"-> "$PIDS_FILE"-sudo OPENLIT_URL=http://127.0.0.1:3000 \- OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318 \- /usr/local/bin/openlit-controller &-echo "$!" >> "$PIDS_FILE"-info "Controller running (PID $!)"--# --- Step 5: Install Python deps and start sample apps ----step "Installing Python dependencies for sample apps"-pip3 install -q \- -r "$EXAMPLES_DIR/openai-chat-app/requirements.txt" \- -r "$EXAMPLES_DIR/anthropic-chat-app/requirements.txt" \- -r "$EXAMPLES_DIR/gemini-chat-app/requirements.txt" \- -r "$EXAMPLES_DIR/crewai-agent-app/requirements.txt"--step "Starting sample apps from examples/ (background)"--OPENAI_API_KEY="${OPENAI_API_KEY:-demo-key}" \- python3 "$EXAMPLES_DIR/openai-chat-app/app.py" &-echo "$!" >> "$PIDS_FILE"-info "Started openai-chat-app (PID $!)"--ANTHROPIC_API_KEY="${ANTHROPIC_API_KEY:-demo-key}" \- python3 "$EXAMPLES_DIR/anthropic-chat-app/app.py" &-echo "$!" >> "$PIDS_FILE"-info "Started anthropic-chat-app (PID $!)"--GEMINI_API_KEY="${GEMINI_API_KEY:-demo-key}" \- python3 "$EXAMPLES_DIR/gemini-chat-app/app.py" &-echo "$!" >> "$PIDS_FILE"-info "Started gemini-chat-app (PID $!)"--OPENAI_API_KEY="${OPENAI_API_KEY:-demo-key}" \- python3 "$EXAMPLES_DIR/crewai-agent-app/app.py" &-echo "$!" >> "$PIDS_FILE"-info "Started crewai-agent-app (PID $!)"--sleep 2-echo ""-info "Demo is running!"-echo ""-echo " Dashboard: http://localhost:3000"-echo " Controller: running on this host"-echo " Sample apps: openai-chat-app, anthropic-chat-app, gemini-chat-app, crewai-agent-app"-echo ""-echo " View logs: docker compose logs -f"-echo " Stop: sudo bash $SCRIPT_DIR/teardown.sh"-echo ""diff --git a/openlit-controller/deploy/linux/teardown.sh b/openlit-controller/deploy/linux/teardown.shdeleted file mode 100755index 8a865856..00000000--- a/openlit-controller/deploy/linux/teardown.sh+++ /dev/null@@ -1,42 +0,0 @@-#!/bin/bash-set -euo pipefail--RED='\033[0;31m'-GREEN='\033[0;32m'-NC='\033[0m'-info() { echo -e "${GREEN}[✓]${NC} $*"; }-step() { echo -e "\n${RED}→${NC} $*"; }--SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"-PIDS_FILE="$SCRIPT_DIR/.demo-pids"--# --- Stop background processes ----step "Stopping sample apps and controller"-if [ -f "$PIDS_FILE" ]; then- while IFS= read -r pid; do- if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then- sudo kill "$pid" 2>/dev/null || true- info "Stopped PID $pid"- fi- done < "$PIDS_FILE"- rm -f "$PIDS_FILE"-else- echo " No PID file found — killing by process name"-fi--pkill -f "openai-chat-app/app.py" 2>/dev/null || true-pkill -f "anthropic-chat-app/app.py" 2>/dev/null || true-pkill -f "gemini-chat-app/app.py" 2>/dev/null || true-pkill -f "crewai-agent-app/app.py" 2>/dev/null || true-sudo pkill -f "openlit-controller" 2>/dev/null || true--# --- Stop Docker services ----step "Stopping ClickHouse + OpenLIT (Docker)"-cd "$SCRIPT_DIR"-docker compose down -v 2>/dev/null || true--info "Teardown complete."-echo ""-echo " To also uninstall the controller binary:"-echo " sudo rm /usr/local/bin/openlit-controller"-echo ""diff --git a/openlit-controller/deploy/openlit-controller.service b/openlit-controller/deploy/openlit-controller.servicedeleted file mode 100644index d2d64445..00000000--- a/openlit-controller/deploy/openlit-controller.service+++ /dev/null@@ -1,14 +0,0 @@-[Unit]-Description=OpenLIT Controller - LLM Observability via eBPF-After=network.target--[Service]-Type=simple-ExecStart=/usr/local/bin/openlit-controller --config /etc/openlit-controller/config.yaml-EnvironmentFile=-/etc/openlit-controller/env-Restart=always-RestartSec=5-AmbientCapabilities=CAP_BPF CAP_SYS_PTRACE CAP_NET_RAW CAP_PERFMON CAP_DAC_READ_SEARCH CAP_CHECKPOINT_RESTORE--[Install]-WantedBy=multi-user.targetdiff --git a/openlit-controller/internal/engine/engine.go b/openlit-controller/internal/engine/engine.goindex e41a3911..8437db24 100644--- a/openlit-controller/internal/engine/engine.go+++ b/openlit-controller/internal/engine/engine.go@@ -14,6 +14,17 @@ import ("go.uber.org/zap")+// ExportConfig holds the OTLP export settings that can be updated at runtime+// from the Agents UI configuration editor.+type ExportConfig struct {+ OTLPEndpoint string+ OTLPProtocol string+ OTLPHeaders map[string]string+ OTLPTracesEndpoint string+ OTLPMetricsEndpoint string+ OTLPLogsEndpoint string+}+// instrumentPattern represents a service pattern for OBI discovery.type instrumentPattern struct {ServiceID string@@ -37,10 +48,10 @@ type Engine struct {logger *zap.Loggerrunning bool- scanner *scanner.Scanner- obi *OBIManager- otlpEndpoint string- procRoot string+ scanner *scanner.Scanner+ obi *OBIManager+ exportCfg ExportConfig+ procRoot stringdeployMode config.DeployModecontainer *ContainerEnricherenvironment string@@ -73,16 +84,19 @@ func New(logger *zap.Logger, obiBinaryPath, otlpEndpoint, procRoot, environment,)return &Engine{- services: make(map[string]*openlit.ServiceState),- patterns: make(map[string]instrumentPattern),- logger: logger,- obi: NewOBIManager(obiBinaryPath, logger),- otlpEndpoint: otlpEndpoint,- procRoot: procRoot,- deployMode: mode,- container: container,- environment: environment,- sdkVersion: sdkVersion,+ services: make(map[string]*openlit.ServiceState),+ patterns: make(map[string]instrumentPattern),+ logger: logger,+ obi: NewOBIManager(obiBinaryPath, logger),+ exportCfg: ExportConfig{+ OTLPEndpoint: otlpEndpoint,+ OTLPProtocol: "http/protobuf",+ },+ procRoot: procRoot,+ deployMode: mode,+ container: container,+ environment: environment,+ sdkVersion: sdkVersion,}}@@ -224,7 +238,7 @@ func (e *Engine) rebuildOBI() error {entries = append(entries, entry)}cfg := BuildInstrumentConfig(- e.otlpEndpoint,+ e.exportCfg,entries,e.enabledProvidersForPatterns(),e.deployMode,@@ -398,6 +412,50 @@ func (e *Engine) ControllerCapabilities() []string {return capabilities}+// UpdateExportConfig replaces the runtime export settings. If OBI-relevant+// fields (endpoint, protocol) changed and OBI is running, it triggers a+// rebuildOBI so the new config takes effect immediately.+func (e *Engine) UpdateExportConfig(cfg ExportConfig) {+ e.mu.Lock()+ defer e.mu.Unlock()++ obiChanged := cfg.OTLPEndpoint != e.exportCfg.OTLPEndpoint ||+ cfg.OTLPProtocol != e.exportCfg.OTLPProtocol ||+ cfg.OTLPTracesEndpoint != e.exportCfg.OTLPTracesEndpoint++ e.exportCfg = cfg+ e.logger.Info("export config updated",+ zap.String("otlp_endpoint", cfg.OTLPEndpoint),+ zap.String("otlp_protocol", cfg.OTLPProtocol),+ zap.String("otlp_traces_endpoint", cfg.OTLPTracesEndpoint),+ zap.String("otlp_metrics_endpoint", cfg.OTLPMetricsEndpoint),+ zap.String("otlp_logs_endpoint", cfg.OTLPLogsEndpoint),+ )++ if obiChanged && e.obi.IsRunning() {+ if err := e.rebuildOBI(); err != nil {+ e.logger.Error("failed to rebuild OBI after export config update", zap.Error(err))+ }+ }+}++// GetExportConfig returns a snapshot of the current export configuration.+// The returned value is a deep copy safe for use outside the engine lock.+func (e *Engine) GetExportConfig() ExportConfig {+ e.mu.RLock()+ defer e.mu.RUnlock()++ cfg := e.exportCfg+ if cfg.OTLPHeaders != nil {+ cloned := make(map[string]string, len(cfg.OTLPHeaders))+ for k, v := range cfg.OTLPHeaders {+ cloned[k] = v+ }+ cfg.OTLPHeaders = cloned+ }+ return cfg+}+func (e *Engine) pruneStaleServices(ctx context.Context) {ticker := time.NewTicker(5 * time.Minute)defer ticker.Stop()diff --git a/openlit-controller/internal/engine/obi.go b/openlit-controller/internal/engine/obi.goindex 7fba6d3b..05d377b5 100644--- a/openlit-controller/internal/engine/obi.go+++ b/openlit-controller/internal/engine/obi.go@@ -336,20 +336,29 @@ type obiAttrIncludeExclude struct {// BuildInstrumentConfig creates an OBI config from pattern-based entries.func BuildInstrumentConfig(- otlpEndpoint string,+ expCfg ExportConfig,entries []obiTarget,enabledProviders map[string]bool,mode config.DeployMode,environment string,) OBIConfig {+ tracesEndpoint := expCfg.OTLPTracesEndpoint+ if tracesEndpoint == "" {+ tracesEndpoint = expCfg.OTLPEndpoint+ }+ protocol := expCfg.OTLPProtocol+ if protocol == "" {+ protocol = "http/protobuf"+ }+excludeOTel := truecfg := OBIConfig{LogLevel: "info",TracePrinter: "text",OTELTraces: obiOTELTraces{- Endpoint: otlpEndpoint,- Protocol: "http/protobuf",+ Endpoint: tracesEndpoint,+ Protocol: protocol,},Routes: obiRoutes{Unmatched: "heuristic",diff --git a/openlit-controller/internal/engine/python_sdk.go b/openlit-controller/internal/engine/python_sdk.goindex 842c6cb6..a6d2368e 100644--- a/openlit-controller/internal/engine/python_sdk.go+++ b/openlit-controller/internal/engine/python_sdk.go@@ -5,6 +5,8 @@ import ("encoding/hex""encoding/json""fmt"+ "net/url"+ "sort""strings""github.com/openlit/openlit/openlit-controller/internal/config"@@ -77,8 +79,24 @@ func (e *Engine) EnablePythonSDK(serviceID string, payload openlit.PythonSDKActiif payload.DuplicatePolicy == "" {payload.DuplicatePolicy = defaultDuplicatePolicy}+ expCfg := e.GetExportConfig()if payload.OTLPEndpoint == "" {- payload.OTLPEndpoint = e.otlpEndpoint+ payload.OTLPEndpoint = expCfg.OTLPEndpoint+ }+ if payload.OTLPProtocol == "" {+ payload.OTLPProtocol = expCfg.OTLPProtocol+ }+ if payload.OTLPHeaders == nil && len(expCfg.OTLPHeaders) > 0 {+ payload.OTLPHeaders = expCfg.OTLPHeaders+ }+ if payload.OTLPTracesEndpoint == "" {+ payload.OTLPTracesEndpoint = expCfg.OTLPTracesEndpoint+ }+ if payload.OTLPMetricsEndpoint == "" {+ payload.OTLPMetricsEndpoint = expCfg.OTLPMetricsEndpoint+ }+ if payload.OTLPLogsEndpoint == "" {+ payload.OTLPLogsEndpoint = expCfg.OTLPLogsEndpoint}if payload.SDKVersion == "" {payload.SDKVersion = e.sdkVersion@@ -931,6 +949,21 @@ func applyPythonSDKContainerSettings(env = upsertEnvValue(env, "OTEL_SERVICE_NAME", svc.ServiceName)env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_ENDPOINT", payload.OTLPEndpoint)env = upsertEnvValue(env, "OTEL_DEPLOYMENT_ENVIRONMENT", payload.Environment)+ if payload.OTLPProtocol != "" {+ env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_PROTOCOL", payload.OTLPProtocol)+ }+ if payload.OTLPTracesEndpoint != "" {+ env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", payload.OTLPTracesEndpoint)+ }+ if payload.OTLPMetricsEndpoint != "" {+ env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT", payload.OTLPMetricsEndpoint)+ }+ if payload.OTLPLogsEndpoint != "" {+ env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT", payload.OTLPLogsEndpoint)+ }+ if len(payload.OTLPHeaders) > 0 {+ env = upsertEnvValue(env, "OTEL_EXPORTER_OTLP_HEADERS", formatOTLPHeaders(payload.OTLPHeaders))+ }env = upsertEnvValue(env,"OPENLIT_DISABLED_INSTRUMENTORS",@@ -956,6 +989,11 @@ func removePythonSDKContainerSettings(container map[string]any) {for _, key := range []string{"OPENLIT_CONTROLLER_MODE","OTEL_EXPORTER_OTLP_ENDPOINT",+ "OTEL_EXPORTER_OTLP_PROTOCOL",+ "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",+ "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",+ "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT",+ "OTEL_EXPORTER_OTLP_HEADERS","OTEL_DEPLOYMENT_ENVIRONMENT","OPENLIT_DISABLED_INSTRUMENTORS",} {@@ -972,6 +1010,28 @@ func removePythonSDKContainerSettings(container map[string]any) {container["volumeMounts"] = objectSliceToAny(volumeMounts)}+// formatOTLPHeaders converts a map of headers to the format specified by the+// OTel spec for OTEL_EXPORTER_OTLP_HEADERS: "key1=value1,key2=value2".+// Values containing ',' or '=' are percent-encoded per the spec. Keys are+// sorted for deterministic output.+func formatOTLPHeaders(headers map[string]string) string {+ keys := make([]string, 0, len(headers))+ for k := range headers {+ keys = append(keys, k)+ }+ sort.Strings(keys)++ parts := make([]string, 0, len(keys))+ for _, k := range keys {+ v := headers[k]+ if strings.ContainsAny(v, ",=") {+ v = url.QueryEscape(v)+ }+ parts = append(parts, k+"="+v)+ }+ return strings.Join(parts, ",")+}+func pythonSDKConfigHash(svc *openlit.ServiceState, payload openlit.PythonSDKActionPayload) string {data, _ := json.Marshal(map[string]any{"service": svc.ID,diff --git a/openlit-controller/internal/engine/python_sdk_runtime.go b/openlit-controller/internal/engine/python_sdk_runtime.goindex aa975a53..8c26784f 100644--- a/openlit-controller/internal/engine/python_sdk_runtime.go+++ b/openlit-controller/internal/engine/python_sdk_runtime.go@@ -307,6 +307,21 @@ func buildDockerContainerCreatePayload(envValues = upsertEnvString(envValues, "OTEL_SERVICE_NAME", svc.ServiceName)envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_ENDPOINT", payload.OTLPEndpoint)envValues = upsertEnvString(envValues, "OTEL_DEPLOYMENT_ENVIRONMENT", payload.Environment)+ if payload.OTLPProtocol != "" {+ envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_PROTOCOL", payload.OTLPProtocol)+ }+ if payload.OTLPTracesEndpoint != "" {+ envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", payload.OTLPTracesEndpoint)+ }+ if payload.OTLPMetricsEndpoint != "" {+ envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT", payload.OTLPMetricsEndpoint)+ }+ if payload.OTLPLogsEndpoint != "" {+ envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT", payload.OTLPLogsEndpoint)+ }+ if len(payload.OTLPHeaders) > 0 {+ envValues = upsertEnvString(envValues, "OTEL_EXPORTER_OTLP_HEADERS", formatOTLPHeaders(payload.OTLPHeaders))+ }envValues = upsertEnvString(envValues,"OPENLIT_DISABLED_INSTRUMENTORS",@@ -321,6 +336,11 @@ func buildDockerContainerCreatePayload(} else {envValues = removeEnvString(envValues, "OPENLIT_CONTROLLER_MODE")envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_ENDPOINT")+ envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_PROTOCOL")+ envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")+ envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT")+ envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT")+ envValues = removeEnvString(envValues, "OTEL_EXPORTER_OTLP_HEADERS")envValues = removeEnvString(envValues, "OTEL_DEPLOYMENT_ENVIRONMENT")envValues = removeEnvString(envValues, "OPENLIT_DISABLED_INSTRUMENTORS")envValues = rewritePythonPathWithoutManagedSDK(envValues)@@ -389,12 +409,22 @@ func (e *Engine) enablePythonSDKLinux(}env := readEnviron(e.procRoot, svc.PID)+ sdPayload := systemdOTLPPayload{+ OTLPEndpoint: payload.OTLPEndpoint,+ OTLPProtocol: payload.OTLPProtocol,+ OTLPTracesEndpoint: payload.OTLPTracesEndpoint,+ OTLPMetricsEndpoint: payload.OTLPMetricsEndpoint,+ OTLPLogsEndpoint: payload.OTLPLogsEndpoint,+ Environment: payload.Environment,+ }+ if len(payload.OTLPHeaders) > 0 {+ sdPayload.OTLPHeaders = formatOTLPHeaders(payload.OTLPHeaders)+ }dropIn := buildSystemdDropInContent(unit,sdkRoot,svc.ServiceName,- payload.OTLPEndpoint,- payload.Environment,+ sdPayload,strings.Join(controllerManagedDisabledInstrumentors, ","),env["PYTHONPATH"],nextHash,@@ -776,6 +806,21 @@ func (e *Engine) enablePythonSDKBareProcess("OTEL_DEPLOYMENT_ENVIRONMENT": payload.Environment,"OPENLIT_DISABLED_INSTRUMENTORS": strings.Join(controllerManagedDisabledInstrumentors, ","),}+ if payload.OTLPProtocol != "" {+ envOverrides["OTEL_EXPORTER_OTLP_PROTOCOL"] = payload.OTLPProtocol+ }+ if payload.OTLPTracesEndpoint != "" {+ envOverrides["OTEL_EXPORTER_OTLP_TRACES_ENDPOINT"] = payload.OTLPTracesEndpoint+ }+ if payload.OTLPMetricsEndpoint != "" {+ envOverrides["OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"] = payload.OTLPMetricsEndpoint+ }+ if payload.OTLPLogsEndpoint != "" {+ envOverrides["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] = payload.OTLPLogsEndpoint+ }+ if len(payload.OTLPHeaders) > 0 {+ envOverrides["OTEL_EXPORTER_OTLP_HEADERS"] = formatOTLPHeaders(payload.OTLPHeaders)+ }newPID, err := restartProcessWithEnv(e.procRoot, svc.PID, envOverrides)if err != nil {diff --git a/openlit-controller/internal/engine/systemd.go b/openlit-controller/internal/engine/systemd.goindex 1c81b531..50e33730 100644--- a/openlit-controller/internal/engine/systemd.go+++ b/openlit-controller/internal/engine/systemd.go@@ -65,8 +65,7 @@ func buildSystemdDropInContent(unit string,sdkRoot string,serviceName string,- otlpEndpoint string,- environment string,+ payload systemdOTLPPayload,disabledInstrumentors string,existingPythonPath string,configHash string,@@ -82,12 +81,37 @@ func buildSystemdDropInContent(buf.WriteString(fmt.Sprintf("Environment=\"PYTHONPATH=%s\"\n", escapeSystemdValue(pythonPath)))buf.WriteString("Environment=\"OPENLIT_CONTROLLER_MODE=agent_observability\"\n")buf.WriteString(fmt.Sprintf("Environment=\"OTEL_SERVICE_NAME=%s\"\n", escapeSystemdValue(serviceName)))- buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_ENDPOINT=%s\"\n", escapeSystemdValue(otlpEndpoint)))- buf.WriteString(fmt.Sprintf("Environment=\"OTEL_DEPLOYMENT_ENVIRONMENT=%s\"\n", escapeSystemdValue(environment)))+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_ENDPOINT=%s\"\n", escapeSystemdValue(payload.OTLPEndpoint)))+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_DEPLOYMENT_ENVIRONMENT=%s\"\n", escapeSystemdValue(payload.Environment)))+ if payload.OTLPProtocol != "" {+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_PROTOCOL=%s\"\n", escapeSystemdValue(payload.OTLPProtocol)))+ }+ if payload.OTLPTracesEndpoint != "" {+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=%s\"\n", escapeSystemdValue(payload.OTLPTracesEndpoint)))+ }+ if payload.OTLPMetricsEndpoint != "" {+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=%s\"\n", escapeSystemdValue(payload.OTLPMetricsEndpoint)))+ }+ if payload.OTLPLogsEndpoint != "" {+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=%s\"\n", escapeSystemdValue(payload.OTLPLogsEndpoint)))+ }+ if payload.OTLPHeaders != "" {+ buf.WriteString(fmt.Sprintf("Environment=\"OTEL_EXPORTER_OTLP_HEADERS=%s\"\n", escapeSystemdValue(payload.OTLPHeaders)))+ }buf.WriteString(fmt.Sprintf("Environment=\"OPENLIT_DISABLED_INSTRUMENTORS=%s\"\n", escapeSystemdValue(disabledInstrumentors)))return buf.String()}+type systemdOTLPPayload struct {+ OTLPEndpoint string+ OTLPProtocol string+ OTLPTracesEndpoint string+ OTLPMetricsEndpoint string+ OTLPLogsEndpoint string+ OTLPHeaders string+ Environment string+}+func escapeSystemdValue(value string) string {return strings.ReplaceAll(value, "\"", "\\\"")}diff --git a/openlit-controller/internal/engine/systemd_test.go b/openlit-controller/internal/engine/systemd_test.goindex 239eaad9..696dd2e7 100644--- a/openlit-controller/internal/engine/systemd_test.go+++ b/openlit-controller/internal/engine/systemd_test.go@@ -12,8 +12,10 @@ func TestBuildSystemdDropInContent(t *testing.T) {"myapp.service","/var/lib/openlit/python-sdk/myapp","myapp",- "http://otel:4318",- "production",+ systemdOTLPPayload{+ OTLPEndpoint: "http://otel:4318",+ Environment: "production",+ },"openai,anthropic","/usr/lib/python3","abc123",@@ -50,8 +52,10 @@ func TestBuildSystemdDropInContentNoPreviousPythonPath(t *testing.T) {"myapp.service","/var/lib/openlit/python-sdk/myapp","myapp",- "http://otel:4318",- "default",+ systemdOTLPPayload{+ OTLPEndpoint: "http://otel:4318",+ Environment: "default",+ },"openai","","hash1",diff --git a/openlit-controller/internal/engine/workload_test.go b/openlit-controller/internal/engine/workload_test.goindex 72af25b9..f3968d86 100644--- a/openlit-controller/internal/engine/workload_test.go+++ b/openlit-controller/internal/engine/workload_test.go@@ -233,7 +233,7 @@ func TestDerivePatternUsesTargetPIDForDockerAndLinux(t *testing.T) {func TestBuildInstrumentConfigEnablesOnlyDetectedProviders(t *testing.T) {cfg := BuildInstrumentConfig(- "http://localhost:4318",+ ExportConfig{OTLPEndpoint: "http://localhost:4318"},nil,map[string]bool{"openai": true,diff --git a/openlit-controller/internal/openlit/types.go b/openlit-controller/internal/openlit/types.goindex 68a09599..67e2b30d 100644--- a/openlit-controller/internal/openlit/types.go+++ b/openlit-controller/internal/openlit/types.go@@ -48,13 +48,18 @@ type PendingAction struct {}type PythonSDKActionPayload struct {- TargetRuntime string `json:"target_runtime"`- InstrumentationProfile string `json:"instrumentation_profile"`- DuplicatePolicy string `json:"duplicate_policy"`- ObservabilityScope string `json:"observability_scope"`- OTLPEndpoint string `json:"otlp_endpoint,omitempty"`- SDKVersion string `json:"sdk_version,omitempty"`- Environment string `json:"environment,omitempty"`+ TargetRuntime string `json:"target_runtime"`+ InstrumentationProfile string `json:"instrumentation_profile"`+ DuplicatePolicy string `json:"duplicate_policy"`+ ObservabilityScope string `json:"observability_scope"`+ OTLPEndpoint string `json:"otlp_endpoint,omitempty"`+ OTLPProtocol string `json:"otlp_protocol,omitempty"`+ OTLPHeaders map[string]string `json:"otlp_headers,omitempty"`+ OTLPTracesEndpoint string `json:"otlp_traces_endpoint,omitempty"`+ OTLPMetricsEndpoint string `json:"otlp_metrics_endpoint,omitempty"`+ OTLPLogsEndpoint string `json:"otlp_logs_endpoint,omitempty"`+ SDKVersion string `json:"sdk_version,omitempty"`+ Environment string `json:"environment,omitempty"`}type ActionResult struct {diff --git a/src/client/package-lock.json b/src/client/package-lock.jsonindex ecfe9674..388c3375 100644--- a/src/client/package-lock.json+++ b/src/client/package-lock.json@@ -1,12 +1,12 @@{"name": "openlit",- "version": "1.19.1",+ "version": "1.20.0","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "openlit",- "version": "1.19.1",+ "version": "1.20.0","dependencies": {"@ai-sdk/anthropic": "^3.0.6","@ai-sdk/cohere": "^3.0.3",diff --git a/src/client/package.json b/src/client/package.jsonindex 5b0fa34a..e97a84c1 100644--- a/src/client/package.json+++ b/src/client/package.json@@ -1,6 +1,6 @@{"name": "openlit",- "version": "1.19.1",+ "version": "1.20.0","private": true,"scripts": {"dev": "next dev",diff --git a/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx b/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsxindex 7750b0ab..1751e589 100644--- a/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx+++ b/src/client/src/app/(playground)/agents/controller/[instance_id]/page.tsx@@ -412,63 +412,64 @@ function ControllerConfigEditor({</div></ConfigSection>- <ConfigSection title={getMessage().AGENTS_CONFIG_EXPORT_SETTINGS}>- <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">- <div>- <label className="block text-xs font-medium text-stone-500 dark:text-stone-400 mb-1">- {getMessage().AGENTS_CONFIG_OTLP_ENDPOINT}- </label>- <input- type="text"- value={config.export.otlp_endpoint}- onChange={(e) =>- setConfig((prev) => ({- ...prev,- export: {- ...prev.export,- otlp_endpoint: e.target.value,- },- }))- }- className="w-full px-3 py-2 text-sm border dark:border-stone-700 rounded-md bg-white dark:bg-stone-800 text-stone-900 dark:text-stone-100 focus:outline-none focus:ring-1 focus:ring-stone-400"- placeholder={getMessage().AGENTS_CONFIG_OTLP_ENDPOINT_PLACEHOLDER}- />- </div>- <div>- <label className="block text-xs font-medium text-stone-500 dark:text-stone-400 mb-1">- {getMessage().AGENTS_CONFIG_OTLP_PROTOCOL}- </label>- <select- value={config.export.otlp_protocol}- onChange={(e) =>- setConfig((prev) => ({- ...prev,- export: {- ...prev.export,- otlp_protocol: e.target.value,- },- }))- }- className="w-full px-3 py-2 text-sm border dark:border-stone-700 rounded-md bg-white dark:bg-stone-800 text-stone-900 dark:text-stone-100 focus:outline-none focus:ring-1 focus:ring-stone-400"- >- <option value="http/protobuf">{getMessage().AGENTS_CONFIG_OTLP_PROTOCOL_HTTP}</option>- <option value="grpc">{getMessage().AGENTS_CONFIG_OTLP_PROTOCOL_GRPC}</option>- </select>- </div>+ <ConfigSection title={getMessage().AGENTS_CONFIG_EXPORT_SETTINGS}>+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">+ <div>+ <label className="block text-xs font-medium text-stone-500 dark:text-stone-400 mb-1">+ {getMessage().AGENTS_CONFIG_OTLP_ENDPOINT}+ </label>+ <input+ type="text"+ value={config.export.otlp_endpoint}+ onChange={(e) =>+ setConfig((prev) => ({+ ...prev,+ export: {+ ...prev.export,+ otlp_endpoint: e.target.value,+ },+ }))+ }+ className="w-full px-3 py-2 text-sm border dark:border-stone-700 rounded-md bg-white dark:bg-stone-800 text-stone-900 dark:text-stone-100 focus:outline-none focus:ring-1 focus:ring-stone-400"+ placeholder={getMessage().AGENTS_CONFIG_OTLP_ENDPOINT_PLACEHOLDER}+ /></div>- <HeadersEditor- headers={config.export.otlp_headers}- onChange={(headers) =>- setConfig((prev) => ({- ...prev,- export: {- ...prev.export,- otlp_headers: headers,- },- }))- }- />- </ConfigSection>+ <div>+ <label className="block text-xs font-medium text-stone-500 dark:text-stone-400 mb-1">+ {getMessage().AGENTS_CONFIG_OTLP_PROTOCOL}+ </label>+ <select+ value={config.export.otlp_protocol}+ onChange={(e) =>+ setConfig((prev) => ({+ ...prev,+ export: {+ ...prev.export,+ otlp_protocol: e.target.value,+ },+ }))+ }+ className="w-full px-3 py-2 text-sm border dark:border-stone-700 rounded-md bg-white dark:bg-stone-800 text-stone-900 dark:text-stone-100 focus:outline-none focus:ring-1 focus:ring-stone-400"+ >+ <option value="http/protobuf">{getMessage().AGENTS_CONFIG_OTLP_PROTOCOL_HTTP}</option>+ <option value="grpc">{getMessage().AGENTS_CONFIG_OTLP_PROTOCOL_GRPC}</option>+ </select>+ </div>+ </div>+ <PerSignalEndpoints config={config} setConfig={setConfig} />+ <HeadersEditor+ headers={config.export.otlp_headers}+ onChange={(headers) =>+ setConfig((prev) => ({+ ...prev,+ export: {+ ...prev.export,+ otlp_headers: headers,+ },+ }))+ }+ />+ </ConfigSection><ConfigSection title={getMessage().AGENTS_CONFIG_DISCOVERY}><div className="flex flex-col gap-3">@@ -539,6 +540,90 @@ function ControllerConfigEditor({);}+function PerSignalEndpoints({+ config,+ setConfig,+}: {+ config: ControllerConfig;+ setConfig: React.Dispatch<React.SetStateAction<ControllerConfig>>;+}) {+ const [expanded, setExpanded] = useState(+ !!(+ config.export.otlp_traces_endpoint ||+ config.export.otlp_metrics_endpoint ||+ config.export.otlp_logs_endpoint+ )+ );++ const fields: {+ key: "otlp_traces_endpoint" | "otlp_metrics_endpoint" | "otlp_logs_endpoint";+ label: string;+ placeholder: string;+ }[] = [+ {+ key: "otlp_traces_endpoint",+ label: "Traces Endpoint",+ placeholder: "e.g. http://victoria-traces:4318",+ },+ {+ key: "otlp_metrics_endpoint",+ label: "Metrics Endpoint",+ placeholder: "e.g. http://victoria-metrics:4318",+ },+ {+ key: "otlp_logs_endpoint",+ label: "Logs Endpoint",+ placeholder: "e.g. http://victoria-logs:4318",+ },+ ];++ return (+ <div className="mt-3">+ <button+ type="button"+ onClick={() => setExpanded(!expanded)}+ className="flex items-center gap-1 text-xs text-stone-500 hover:text-stone-700 dark:text-stone-400 dark:hover:text-stone-300 transition-colors"+ >+ {expanded ? (+ <ChevronDown className="w-3 h-3" />+ ) : (+ <ChevronRight className="w-3 h-3" />+ )}+ Per-signal endpoint overrides+ </button>+ {expanded && (+ <div className="mt-2 grid grid-cols-1 sm:grid-cols-3 gap-3">+ {fields.map(({ key, label, placeholder }) => (+ <div key={key}>+ <label className="block text-xs font-medium text-stone-500 dark:text-stone-400 mb-1">+ {label}+ </label>+ <input+ type="text"+ value={config.export[key] || ""}+ onChange={(e) =>+ setConfig((prev) => ({+ ...prev,+ export: {+ ...prev.export,+ [key]: e.target.value,+ },+ }))+ }+ className="w-full px-3 py-2 text-sm border dark:border-stone-700 rounded-md bg-white dark:bg-stone-800 text-stone-900 dark:text-stone-100 focus:outline-none focus:ring-1 focus:ring-stone-400"+ placeholder={placeholder}+ />+ </div>+ ))}+ <p className="col-span-full text-xs text-stone-400">+ Leave empty to use the main OTLP endpoint for all signals.+ </p>+ </div>+ )}+ </div>+ );+}+function ConfigSection({title,children,@@ -711,6 +796,9 @@ function mergeConfig(saved.export?.otlp_headers || defaults.export.otlp_headers,otlp_protocol:saved.export?.otlp_protocol || defaults.export.otlp_protocol,+ otlp_traces_endpoint: saved.export?.otlp_traces_endpoint || "",+ otlp_metrics_endpoint: saved.export?.otlp_metrics_endpoint || "",+ otlp_logs_endpoint: saved.export?.otlp_logs_endpoint || "",},discovery: {auto_discover:diff --git a/src/client/src/lib/platform/controller/features/agent.ts b/src/client/src/lib/platform/controller/features/agent.tsindex af61baef..f2c22a58 100644--- a/src/client/src/lib/platform/controller/features/agent.ts+++ b/src/client/src/lib/platform/controller/features/agent.ts@@ -2,6 +2,7 @@ import {getServiceById,getControllerInstanceById,getControllerIdsForWorkload,+ getControllerConfig,queueAction,updateFeatureDesiredState,} from "@/lib/platform/controller";@@ -223,6 +224,32 @@ const agentHandler: FeatureHandler = {targets.push(ctx.service.controller_instance_id);}+ let exportOverrides: Partial<PythonSDKActionPayload> = {};+ if (enabling) {+ const cfgRes = await getControllerConfig(+ ctx.service.controller_instance_id,+ dbConfigId+ );+ const raw = cfgRes.data?.[0]?.config;+ if (raw) {+ try {+ const savedCfg = JSON.parse(raw) as import("@/types/controller").ControllerConfig;+ const exp = savedCfg.export;+ if (exp) {+ if (exp.otlp_endpoint) exportOverrides.otlp_endpoint = exp.otlp_endpoint;+ if (exp.otlp_protocol) exportOverrides.otlp_protocol = exp.otlp_protocol;+ if (exp.otlp_headers && Object.keys(exp.otlp_headers).length > 0)+ exportOverrides.otlp_headers = exp.otlp_headers;+ if (exp.otlp_traces_endpoint) exportOverrides.otlp_traces_endpoint = exp.otlp_traces_endpoint;+ if (exp.otlp_metrics_endpoint) exportOverrides.otlp_metrics_endpoint = exp.otlp_metrics_endpoint;+ if (exp.otlp_logs_endpoint) exportOverrides.otlp_logs_endpoint = exp.otlp_logs_endpoint;+ }+ } catch {+ // Config parse failure is non-fatal; the controller will use its defaults.+ }+ }+ }+const actionPayload: PythonSDKActionPayload = {target_runtime: "python",instrumentation_profile: "controller_managed",@@ -230,8 +257,9 @@ const agentHandler: FeatureHandler = {observability_scope: "agent",...(enabling? {+ ...exportOverrides,otlp_endpoint:- (payload?.otlp_endpoint as string) || null,+ (payload?.otlp_endpoint as string) || exportOverrides.otlp_endpoint || null,enable_http_instrumentation:(payload?.enable_http_instrumentation as boolean) ??true,diff --git a/src/client/src/types/controller.ts b/src/client/src/types/controller.tsindex 2ae4472f..a80e87d9 100644--- a/src/client/src/types/controller.ts+++ b/src/client/src/types/controller.ts@@ -51,6 +51,9 @@ export interface ExportConfig {otlp_endpoint: string;otlp_headers: Record<string, string>;otlp_protocol: string;+ otlp_traces_endpoint?: string;+ otlp_metrics_endpoint?: string;+ otlp_logs_endpoint?: string;}export interface DiscoveryTarget {@@ -160,6 +163,11 @@ export interface PythonSDKActionPayload {duplicate_policy: PythonSDKDuplicatePolicy;observability_scope: PythonSDKObservabilityScope;otlp_endpoint?: string | null;+ otlp_protocol?: string;+ otlp_headers?: Record<string, string>;+ otlp_traces_endpoint?: string;+ otlp_metrics_endpoint?: string;+ otlp_logs_endpoint?: string;sdk_version?: string;enable_http_instrumentation?: boolean;resource_attributes?: Record<string, string>;