83d516afa1
FastAPI gateway with A/B/C lane orchestration, LiteLLM proxy config, Swarm stack (postgres, redis, VPN off-by-default), deploy/smoke/audit scripts.
37 lines
1.2 KiB
Bash
37 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# Vendor LiteLLM official Grafana dashboard JSON into EventHubDevOps
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
LITELLM_REF="${LITELLM_REF:-main-v1.96.0-stable}"
|
|
DEVOPS="${DEVOPS_ROOT:-$(cd "$ROOT/../EventHubDevOps" 2>/dev/null && pwd || echo "")}"
|
|
|
|
if [[ -z "$DEVOPS" || ! -d "$DEVOPS/ift/observability" ]]; then
|
|
echo "DEVOPS_ROOT not found — set to EventHubDevOps path" >&2
|
|
exit 1
|
|
fi
|
|
|
|
DEST="${DEVOPS}/ift/observability/grafana/dashboards/litellm"
|
|
mkdir -p "$DEST"
|
|
|
|
BASE="https://raw.githubusercontent.com/BerriAI/litellm/${LITELLM_REF}/cookbook/litellm_proxy_server/grafana_dashboard"
|
|
|
|
fetch() {
|
|
local src="$1" dst="$2"
|
|
echo "Fetching $src"
|
|
curl -fsSL "${BASE}/${src}" -o "${DEST}/${dst}"
|
|
}
|
|
|
|
fetch "dashboard_v2/grafana_dashboard.json" "litellm-v2.json"
|
|
fetch "dashboard_1/grafana_dashboard.json" "litellm-v1.json" || true
|
|
|
|
if command -v jq >/dev/null 2>&1; then
|
|
for f in litellm-v2.json litellm-v1.json; do
|
|
[[ -f "${DEST}/${f}" ]] || continue
|
|
jq 'walk(if type=="object" and has("datasource") then .datasource="prometheus" else . end)' \
|
|
"${DEST}/${f}" > "${DEST}/${f}.tmp" && mv "${DEST}/${f}.tmp" "${DEST}/${f}"
|
|
done
|
|
fi
|
|
|
|
echo "Dashboards written to ${DEST}"
|