fix(substrate): return 200 with empty result when ate.dev CRDs are not installed#2041
Closed
mesutoezdil wants to merge 6 commits into
Closed
fix(substrate): return 200 with empty result when ate.dev CRDs are not installed#2041mesutoezdil wants to merge 6 commits into
mesutoezdil wants to merge 6 commits into
Conversation
Adds an optional prometheus.url value. When set, the URL is injected into the agent system message so the agent knows which endpoint to use. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…asourceName The observability agent queries Prometheus exclusively through the Grafana MCP tool server. Tools like query_prometheus take a Grafana datasourceUid, not a raw Prometheus endpoint, so injecting a URL into the system message provided no actionable value. Replace prometheus.url with grafana.prometheusDatasourceName. When set, the agent is told which Grafana datasource to use for all Prometheus queries, matching how the tools actually work. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…by_name with get_datasource Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
…essage Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Contributor
Author
|
duplicate of #2023 |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes /api/substrate/status to avoid returning HTTP 500 when ate.dev CRDs are not installed by treating “no match” REST-mapper errors as an empty result set.
Changes:
- Handle
meta.IsNoMatchErrorduring substrate CR listing so clusters withoutagent-substratereturn a 200 with empty resource lists. - Extend the Observability agent Helm chart values/template to optionally pin a Grafana Prometheus datasource name and update the Grafana MCP tool name.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| helm/agents/observability/values.yaml | Adds optional grafana.prometheusDatasourceName chart value. |
| helm/agents/observability/templates/agent.yaml | Uses the optional datasource name in the agent prompt and updates Grafana MCP tool list. |
| go/core/internal/httpserver/handlers/substrate.go | Treats meta.IsNoMatchError from Kubernetes list calls as “no substrate installed” instead of a 500. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
112
to
125
| wpList := &atev1alpha1.WorkerPoolList{} | ||
| if err := h.KubeClient.List(ctx, wpList, listOpts...); err != nil { | ||
| if meta.IsNoMatchError(err) { | ||
| return nil, nil, nil | ||
| } | ||
| return nil, nil, err | ||
| } | ||
| tmplList := &atev1alpha1.ActorTemplateList{} | ||
| if err := h.KubeClient.List(ctx, tmplList, listOpts...); err != nil { | ||
| if meta.IsNoMatchError(err) { | ||
| return nil, nil, nil | ||
| } | ||
| return nil, nil, err | ||
| } |
Comment on lines
+25
to
+29
| {{- with .Values.grafana }}{{- if .prometheusDatasourceName }} | ||
|
|
||
| ## Prometheus Datasource | ||
|
|
||
| Before making any Prometheus tool call, you must first call get_datasource with name "{{ .prometheusDatasourceName }}" to resolve the datasource UID. Use that UID for all subsequent Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). |
Comment on lines
113
to
117
| if err := h.KubeClient.List(ctx, wpList, listOpts...); err != nil { | ||
| if meta.IsNoMatchError(err) { | ||
| return nil, nil, nil | ||
| } | ||
| return nil, nil, err |
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.
Closes #2024
listSubstrateCRscallsKubeClient.ListonWorkerPoolListandActorTemplateListunconditionally. Whenate.devCRDs are not installed, the REST mapper returns aNoKindMatchErrorwhich propagates as HTTP 500.Treat
meta.IsNoMatchErroras an empty result so the endpoint returns 200 withEnabled: falseon clusters without agent-substrate.