fix: wire update_checks into telemetry-sync + session count fallback

Three bug fixes:
- Telemetry-sync now pings update_checks on successful event sync
  (previously only in gstack-update-check on cache-miss path)
- community-pulse falls back to distinct session_id count when
  update_checks is empty
- Dashboard queries session_id and shows unique session count

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-19 22:54:31 -07:00
parent 3f2dca1aaa
commit c784e18e6e
3 changed files with 81 additions and 7 deletions
+20 -1
View File
@@ -118,7 +118,26 @@ HTTP_CODE="$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 \
# ─── Update cursor on success (2xx) ─────────────────────────
case "$HTTP_CODE" in
2*) NEW_CURSOR=$(( CURSOR + COUNT ))
echo "$NEW_CURSOR" > "$CURSOR_FILE" 2>/dev/null || true ;;
echo "$NEW_CURSOR" > "$CURSOR_FILE" 2>/dev/null || true
# Ping update_checks (install base proxy)
GSTACK_VERSION="$(cat "$GSTACK_DIR/VERSION" 2>/dev/null | tr -d '[:space:]' || echo "unknown")"
_OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
curl -sf --max-time 5 \
-X POST "${ENDPOINT}/update_checks" \
-H "Content-Type: application/json" \
-H "apikey: ${ANON_KEY}" \
-H "Authorization: Bearer ${ANON_KEY}" \
-H "Prefer: return=minimal" \
-d "{\"gstack_version\":\"$GSTACK_VERSION\",\"os\":\"$_OS\"}" \
>/dev/null 2>&1 || true
# Trigger community backup if community tier
BACKUP_CMD="$GSTACK_DIR/bin/gstack-community-backup"
if [ "$TIER" = "community" ] && [ -x "$BACKUP_CMD" ]; then
"$BACKUP_CMD" 2>/dev/null &
fi
;;
esac
# Update rate limit marker