Skip to content

feat: Prometheus connector - #512

Draft
OlivierTrudeau wants to merge 17 commits into
mainfrom
prometheus
Draft

feat: Prometheus connector#512
OlivierTrudeau wants to merge 17 commits into
mainfrom
prometheus

Conversation

@OlivierTrudeau

@OlivierTrudeau OlivierTrudeau commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Prometheus/VictoriaMetrics connector to Aurora — supports connecting to any Prometheus-compatible TSDB, ingesting Alertmanager webhooks for incident correlation, and on-demand PromQL querying via the AI agent.


Tested

  • No Auth — direct proxy, queries return data
  • Basic Auth — returns 401 without creds, 200 with testuser:testpass123
  • Bearer Token — returns 401 without token, 200 with Bearer aurora-test-token-2026
  • Custom Header — returns 401 without header, 200 with X-Prometheus-Key: x-prometheus-secret-key-123
  • All 4 methods verified both internally (port-forward) and externally (GKE LoadBalancer at 136.109.73.175)
  • Backend auto-detection of Prometheus vs VictoriaMetrics vs Thanos via /api/v1/status/buildinfo

Not yet tested

  • HTTPS with self-signed certificate (Verify SSL toggle untested)
  • Expired/invalid credentials error messaging in UI
  • Network unreachable / wrong URL error handling in UI
  • Alertmanager webhook ingestion end-to-end
  • Alert correlation + incident creation flow
  • Agent tool execution during RCA
  • Multi-instance support (connecting multiple Prometheus per org)
  • Frontend connect/disconnect flow end-to-end

Not covered (out of scope for v1)

  • Amazon Managed Prometheus (AMP) — requires AWS SigV4 signing, a different auth paradigm
  • mTLS (mutual TLS / client certificates)
  • Remote agent relay for SaaS (Prometheus behind VPN/private network) — planned as kubectl agent extension
  • OAuth2/OIDC with token refresh (e.g. GCP managed Prometheus)
  • Prometheus federation queries

Made with Cursor

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 72d09ab3-4572-490f-97c9-979f1e271b65

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch prometheus

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread server/main_compute.py Fixed
Comment thread server/main_compute.py Fixed
Comment thread server/main_compute.py Fixed
logger.warning("[PROMETHEUS] Failed to clean up secrets during disconnect")
return jsonify({"success": False, "error": "Failed to delete stored credentials"}), 500

logger.info("[PROMETHEUS] Disconnected user %s (deleted %d token rows)", user_id, deleted)
timeout=PROMETHEUS_TIMEOUT,
)
except ValueError as exc:
return jsonify({"error": str(exc)}), 400
build_info = client.validate_connection()
except PrometheusAPIError as exc:
logger.warning("[PROMETHEUS] Validation failed for user %s: %s", user_id, exc)
return jsonify({"error": f"Failed to connect to Prometheus: {exc}"}), 400
logger.info("[PROMETHEUS] Alertmanager validated at %s for user %s", sanitize(alertmanager_url), sanitize(user_id))
except (AMError, Exception) as exc:
logger.warning("[PROMETHEUS] Alertmanager validation failed for user %s: %s", user_id, exc)
return jsonify({"error": f"Prometheus connected, but cannot reach Alertmanager at {alertmanager_url}: {exc}"}), 400
Comment thread server/connectors/prometheus_connector/base_client.py Fixed
Comment thread server/services/incident_pipeline.py Fixed
Comment thread server/main_compute.py Fixed
Comment thread server/routes/prometheus/prometheus_routes.py Fixed
Comment thread server/routes/prometheus/prometheus_routes.py Fixed
Comment thread server/main_compute.py
# --- Prometheus Integration Routes ---
from routes.prometheus import bp as prometheus_bp # noqa: F401
app.register_blueprint(prometheus_bp, url_prefix="/prometheus")
from routes.prometheus import tasks as _prometheus_tasks # noqa: F401
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

import base64
import logging
import time
from typing import Any, Dict, List, Optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants