Skip to content

fix: pass prometheus and grafana config as env vars in helm chart - #63

Open
ruslanaliyevn wants to merge 1 commit into
kagent-dev:mainfrom
ruslanaliyevn:fix/prometheus-url-helm
Open

fix: pass prometheus and grafana config as env vars in helm chart#63
ruslanaliyevn wants to merge 1 commit into
kagent-dev:mainfrom
ruslanaliyevn:fix/prometheus-url-helm

Conversation

@ruslanaliyevn

Copy link
Copy Markdown

Problem

tools.prometheus.url, tools.prometheus.username, tools.prometheus.password,
tools.grafana.url and tools.grafana.apiKey values were defined in values.yaml
but never passed to the container as environment variables in deployment.yaml.

Solution

Added the missing environment variables to the deployment template so that
Prometheus and Grafana configuration is properly passed to the tool server.

Fixes #36

Signed-off-by: Ruslan Aliyev <ruslanaliyevn@email.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the kagent-tools Helm chart Deployment template to actually wire Prometheus and Grafana configuration values (previously present only in values.yaml) into the running container via environment variables, addressing issue #36.

Changes:

  • Add missing Prometheus and Grafana environment variables to helm/kagent-tools/templates/deployment.yaml.
  • Minor template cleanup/formatting adjustments in the same manifest.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +97 to +98
- name: PROMETHEUS_URL
value: {{ .Values.tools.prometheus.url | quote }}
Comment on lines +99 to +102
- name: PROMETHEUS_USERNAME
value: {{ .Values.tools.prometheus.username | quote }}
- name: PROMETHEUS_PASSWORD
value: {{ .Values.tools.prometheus.password | quote }}
Comment on lines +101 to +106
- name: PROMETHEUS_PASSWORD
value: {{ .Values.tools.prometheus.password | quote }}
- name: GRAFANA_URL
value: {{ .Values.tools.grafana.url | quote }}
- name: GRAFANA_API_KEY
value: {{ .Values.tools.grafana.apiKey | quote }}
Comment on lines +97 to +106
- name: PROMETHEUS_URL
value: {{ .Values.tools.prometheus.url | quote }}
- name: PROMETHEUS_USERNAME
value: {{ .Values.tools.prometheus.username | quote }}
- name: PROMETHEUS_PASSWORD
value: {{ .Values.tools.prometheus.password | quote }}
- name: GRAFANA_URL
value: {{ .Values.tools.grafana.url | quote }}
- name: GRAFANA_API_KEY
value: {{ .Values.tools.grafana.apiKey | quote }}
@dimetron
dimetron self-requested a review June 23, 2026 14:41
jedi-tal added a commit to jedi-tal/tools that referenced this pull request Aug 14, 2026
`PROMETHEUS_URL` is documented in the README ("Default Prometheus server
URL") but was never read: every prometheus_* handler hard-coded
`http://localhost:9090` as the fallback for the optional `prometheus_url`
parameter, and the Helm chart's `tools.prometheus.url` value was never
passed to the container (kagent-dev#63, kagent-dev#36).

The practical effect is that the ONLY way to reach a Prometheus that is
not on localhost is for the model to pass `prometheus_url` on every single
call. Because the parameter is optional and the schema advertises a
plausible-looking default, models routinely omit it - the call then fails
with "connection refused" against a port nothing serves inside the tool
server's pod, and the agent burns a turn retrying. On one of our scheduled
survey agents this wasted 12 of a 24-call budget in a single run.

- read `PROMETHEUS_URL` (trimmed) as the default, falling back to
  `http://localhost:9090` when unset, so existing deployments are unchanged
- build the `prometheus_url` parameter description from that same value, so
  the tool schema advertises the default a caller will actually get instead
  of always claiming localhost
- render `PROMETHEUS_URL` in the chart from `tools.prometheus.url`, only
  when set; its previous default was schemeless
  (`prometheus.kagent.svc.cluster.local:9090`) and would have been rejected
  by `security.ValidateURL`, so it now defaults to empty = tool default

The explicit `prometheus_url` parameter still wins when supplied.

Closes kagent-dev#63

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: jedi-tal <tal@jedify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools.prometheus.url value is defined but not used in kagent-tools Helm chart

2 participants