From 2d493be2e4d9528a5a2650226171d554134c6dca Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Tue, 9 Jun 2026 22:18:16 +0200 Subject: [PATCH 1/5] feat(observability): add configurable prometheus.url to agent chart 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 --- helm/agents/observability/templates/agent.yaml | 6 ++++++ helm/agents/observability/values.yaml | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index 8d7a05a10..85f6b590f 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -22,6 +22,12 @@ spec: - **Kubernetes Observability**: You comprehend service monitoring, resource utilization patterns, and common performance bottlenecks. - **Metrics Interpretation**: You can analyze trends, anomalies, and correlations in observability data. - **Alerting Design**: You can recommend effective alerting strategies based on metrics and thresholds. + {{- with .Values.prometheus }}{{- if .url }} + + ## Prometheus Configuration + + The Prometheus server for this cluster is available at {{ .url }}. Use this URL when you need to query Prometheus directly. + {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} diff --git a/helm/agents/observability/values.yaml b/helm/agents/observability/values.yaml index 1cfd5eeaf..d2ddb630c 100644 --- a/helm/agents/observability/values.yaml +++ b/helm/agents/observability/values.yaml @@ -15,3 +15,8 @@ resources: memory: 1Gi compaction: {} + +# -- Optional Prometheus server URL (e.g. "http://prometheus:9090"). When set, it is injected +# into the agent's system message so the agent knows which Prometheus endpoint to use. +prometheus: + url: "" From c70e5f2575fdacd92dcfda5a4d3eb29a6f2d2b7f Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Mon, 15 Jun 2026 23:04:11 +0200 Subject: [PATCH 2/5] fix(observability): replace prometheus.url with grafana.prometheusDatasourceName 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 --- helm/agents/observability/templates/agent.yaml | 6 +++--- helm/agents/observability/values.yaml | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index 85f6b590f..a38f63bd2 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -22,11 +22,11 @@ spec: - **Kubernetes Observability**: You comprehend service monitoring, resource utilization patterns, and common performance bottlenecks. - **Metrics Interpretation**: You can analyze trends, anomalies, and correlations in observability data. - **Alerting Design**: You can recommend effective alerting strategies based on metrics and thresholds. - {{- with .Values.prometheus }}{{- if .url }} + {{- with .Values.grafana }}{{- if .prometheusDatasourceName }} - ## Prometheus Configuration + ## Prometheus Datasource - The Prometheus server for this cluster is available at {{ .url }}. Use this URL when you need to query Prometheus directly. + Use "{{ .prometheusDatasourceName }}" as the Grafana datasource name for all Prometheus queries (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} diff --git a/helm/agents/observability/values.yaml b/helm/agents/observability/values.yaml index d2ddb630c..871a6ce4c 100644 --- a/helm/agents/observability/values.yaml +++ b/helm/agents/observability/values.yaml @@ -16,7 +16,7 @@ resources: compaction: {} -# -- Optional Prometheus server URL (e.g. "http://prometheus:9090"). When set, it is injected -# into the agent's system message so the agent knows which Prometheus endpoint to use. -prometheus: - url: "" +# -- Optional Grafana datasource name for Prometheus (e.g. "Prometheus"). When set, the agent +# uses this datasource name for all Prometheus queries instead of discovering it at runtime. +grafana: + prometheusDatasourceName: "" From 0370e7e9227f1e0086fbc6a8ca68f3fa06e1af1b Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 19:10:41 +0200 Subject: [PATCH 3/5] fix(observability): replace get_datasource_by_uid and get_datasource_by_name with get_datasource Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index a38f63bd2..a9e68a032 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -26,7 +26,7 @@ spec: ## Prometheus Datasource - Use "{{ .prometheusDatasourceName }}" as the Grafana datasource name for all Prometheus queries (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). + Call get_datasource with name "{{ .prometheusDatasourceName }}" once to get the datasource UID. Use that UID for all Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} @@ -100,8 +100,7 @@ spec: - get_sift_analysis - get_oncall_shift - get_incident - - get_datasource_by_uid - - get_datasource_by_name + - get_datasource - get_dashboard_panel_queries - get_dashboard_by_uid - get_current_oncall_users From 223371d3ade21ec9523b7990c7a7feb62567f928 Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 22:52:39 +0200 Subject: [PATCH 4/5] fix(observability): strengthen get_datasource instruction in system message Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index a9e68a032..f602ad71e 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -26,7 +26,7 @@ spec: ## Prometheus Datasource - Call get_datasource with name "{{ .prometheusDatasourceName }}" once to get the datasource UID. Use that UID for all Prometheus tool calls (query_prometheus, list_prometheus_metric_names, list_prometheus_label_names, list_prometheus_label_values, list_prometheus_metric_metadata). + 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). {{- end }}{{- end }} {{ `{{include "builtin/kubernetes-context"}}` }} From a69a126c02741d3a88feea99a297e6367373349b Mon Sep 17 00:00:00 2001 From: mesutoezdil Date: Wed, 17 Jun 2026 23:40:38 +0200 Subject: [PATCH 5/5] fix(observability): use with pattern for prometheusDatasourceName Signed-off-by: mesutoezdil --- helm/agents/observability/templates/agent.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helm/agents/observability/templates/agent.yaml b/helm/agents/observability/templates/agent.yaml index f602ad71e..2276056ad 100644 --- a/helm/agents/observability/templates/agent.yaml +++ b/helm/agents/observability/templates/agent.yaml @@ -22,12 +22,12 @@ spec: - **Kubernetes Observability**: You comprehend service monitoring, resource utilization patterns, and common performance bottlenecks. - **Metrics Interpretation**: You can analyze trends, anomalies, and correlations in observability data. - **Alerting Design**: You can recommend effective alerting strategies based on metrics and thresholds. - {{- with .Values.grafana }}{{- if .prometheusDatasourceName }} + {{- with .Values.grafana.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). - {{- end }}{{- end }} + Before making any Prometheus tool call, you must first call get_datasource with name "{{ . }}" 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). + {{- end }} {{ `{{include "builtin/kubernetes-context"}}` }}