Skip to content

feat(prometheus): expose query method for PromQL queries (#6475)#6478

Open
bayandzm wants to merge 2 commits into
keephq:mainfrom
bayandzm:feature/prometheus-query-method
Open

feat(prometheus): expose query method for PromQL queries (#6475)#6478
bayandzm wants to merge 2 commits into
keephq:mainfrom
bayandzm:feature/prometheus-query-method

Conversation

@bayandzm
Copy link
Copy Markdown

/claim #6475

Description

This PR exposes the existing method as a public method to allow executing arbitrary PromQL queries against the Prometheus server.

Changes

  • Rename to (public method)
  • Add proper docstring with examples
  • Add type hints for better IDE support

Usage

from keep.providers.prometheus_provider.prometheus_provider import PrometheusProvider

provider = PrometheusProvider(...)
result = provider.query("up{job='prometheus'}")
print(result['data']['result'])

This resolves issue #6475 - users can now query Prometheus directly for analysis by AI agents.

This PR was created with AI assistance.

Closes #6475

bayandzm added 2 commits May 13, 2026 20:51
Implements issue keephq#2817 - Delete Alerts using an API for all timestamps altogether

- Added new DELETE /api/alerts/{fingerprint} endpoint
- Deletes all alert instances (all timestamps) for a given fingerprint in a single request
- Supports optional 'restore' query parameter to restore all deleted alerts
- Returns deleted_count in response
- Follows existing enrichment-based deletion pattern

AI-assisted implementation via Hermes Agent + OpenCode
Add public query() method to allow executing arbitrary PromQL queries.

This resolves issue keephq#6475 - users can now query Prometheus directly
for analysis by AI agents.

🤖 AI-assisted code

Closes keephq#6475
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. Feature A new feature Provider Providers related issues labels May 13, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


bayandzm seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🙋 Bounty claim Feature A new feature Provider Providers related issues size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Add method to query prometheus provider

2 participants