-
Notifications
You must be signed in to change notification settings - Fork 29
Add observability toolset for Prometheus and Alertmanager queries #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add observability toolset for Prometheus and Alertmanager queries #117
Conversation
Introduces a new observability toolset that provides tools for querying OpenShift cluster monitoring data: - prometheus_query: Execute instant PromQL queries against Thanos Querier - prometheus_query_range: Execute range PromQL queries for time-series data - alertmanager_alerts: Query active, silenced, and inhibited alerts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Sharat Akhoury <sakhoury@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sakhoury The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
see the comment on my draft PR here please: #115 (comment) |
Refactors the observability toolset to use a shared Prometheus client package that can be reused by other toolsets. The pkg/prometheus/ package provides: - Client with functional options for flexible configuration - Support for bearer token auth from REST config - TLS configuration from REST config or custom CA - Prometheus instant and range query methods - Alertmanager alerts query methods - Relative time conversion utilities Signed-off-by: Sharat Akhoury <sakhoury@redhat.com>
|
/cc @bentito |
|
/cc @matzew |
|
@nader-ziada can you take a look? |
nader-ziada
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work @sakhoury just a minor comment that could be done later
| return defaultMonitoringNamespace | ||
| } | ||
|
|
||
| // getRouteURL retrieves the URL for an OpenShift route. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every Prometheus/Alertmanager query hits the Kubernetes API to resolve the route, even though routes rarely change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @nader-ziada! You're right that hitting the k8s API on every query is inefficient since routes rarely change.
I can implement per-session caching in which the route URL will be resolved once on first use and cached for the lifetime of the MCP server process. This eliminates the repeated API calls while keeping the auto-discovery behaviour. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would be great. thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing to note is that if you are caching this, the kubernetes instance you are given is configured for you to communicate to a specific cluster in an ACM setup. So, you will need to be careful to make sure you aren't using an invalid url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Cali0707! I missed that. Updating now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've added per-session caching with support for multi-cluster environments.
|
@matzew can we run mcpchecker here? |
No, we need to figure out how to configure prow to get that working... |
Route URLs are now cached for the lifetime of the server process. This eliminates redundant Kubernetes API calls on every Prometheus or Alertmanager query, since OpenShift routes rarely change. The cache key includes the API server host to ensure correct behavior in multi-cluster (ACM) environments where different clusters have different route URLs. Signed-off-by: Sharat Akhoury <sakhoury@redhat.com>
db4c64c to
6ecb87e
Compare
|
@sakhoury: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Introduces a new observability toolset that provides tools for querying OpenShift cluster monitoring data: