feat: add Prometheus datasource connector for real-time metrics querying#173
Open
RichardoMrMu wants to merge 1 commit intoderisk-ai:mainfrom
Open
feat: add Prometheus datasource connector for real-time metrics querying#173RichardoMrMu wants to merge 1 commit intoderisk-ai:mainfrom
RichardoMrMu wants to merge 1 commit intoderisk-ai:mainfrom
Conversation
Add PrometheusConnector that enables OpenDerisk agents to query Prometheus HTTP API for real-time metrics data, replacing the dependency on static OpenRCA datasets. Features: - Instant query (PromQL evaluation at a single point in time) - Range query (PromQL evaluation over a time range with configurable step) - Series discovery (find time series matching label selectors) - Label enumeration (list label names and values) - Target and rule inspection (scrape targets, alerting/recording rules) - Active alerts listing - Health check endpoint - Metric metadata retrieval - Basic authentication and custom headers support - SSL/TLS configuration - Formatted output compatible with BaseConnector.run() interface The connector inherits from BaseConnector and can be used by SRE agents for real-time diagnostics and root cause analysis. Includes comprehensive unit tests with mocked HTTP responses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
PrometheusConnectorthat enables OpenDerisk agents to query Prometheus HTTP API for real-time metrics data, replacing the dependency on static OpenRCA datasets for metrics analysis.Motivation
Currently, OpenDerisk's SRE agents rely on static OpenRCA datasets (CSV files) for metrics analysis during root cause diagnosis. This limits the system to offline/historical analysis and prevents real-time monitoring and diagnostics.
By adding a Prometheus datasource connector, agents can:
Changes
packages/derisk-ext/src/derisk_ext/datasource/conn_prometheus.pypackages/derisk-ext/src/derisk_ext/datasource/tests/__init__.pypackages/derisk-ext/src/derisk_ext/datasource/tests/test_conn_prometheus.pyKey Features
Design Decisions
BaseConnector(notRDBMSConnector) since Prometheus is a time-series database, not a relational databaserequestslibrary for HTTP API calls (already a project dependency)run()method for compatibility with the BaseConnector interface, treating the command as a PromQL expressionUsage Example
Testing
Comprehensive unit tests with mocked HTTP responses covering:
run()interface compatibilityRelated