Fix ServiceMonitor label mismatch so Prometheus can scrape metrics #15

Closed
opened 2026-05-25 03:03:48 +00:00 by ldraney · 0 comments
Owner

Type

Feature

Lineage

Standalone -- discovered during observability gap audit of landscaping-assistant deployment.

Repo

ldraney/pal-e-deployments

User Story

As an operator
I want the ServiceMonitor selector to match the landscaping-assistant pod labels
So that Prometheus can discover and scrape the app's metrics endpoint

Context

The base ServiceMonitor at bases/standard/servicemonitor.yaml uses selector.matchLabels.app: app. The landscaping-assistant prod kustomize overlay renames all Deployment and Service labels from app to landscaping-assistant, but has no corresponding patch for the ServiceMonitor. This means the ServiceMonitor selector never matches any pods, and Prometheus cannot scrape the app. The base kustomization also does not include ServiceMonitor in its resources list (it may be commented out or missing).

File Targets

Files the agent should modify or create:

  • overlays/landscaping-assistant/prod/kustomization.yaml -- add ServiceMonitor JSON patch to rename matchLabels.app to landscaping-assistant and metadata name to landscaping-assistant
  • bases/standard/kustomization.yaml -- ensure servicemonitor.yaml is listed in resources (currently missing)

Files the agent should NOT touch:

  • bases/standard/servicemonitor.yaml -- base template should stay generic
  • overlays/landscaping-assistant/dev/ -- dev uses its own resource set

Acceptance Criteria

  • ServiceMonitor patch added to prod kustomization that sets matchLabels.app: landscaping-assistant
  • ServiceMonitor metadata name patched to landscaping-assistant
  • kustomize build renders the patched ServiceMonitor with correct selectors
  • Prometheus target page shows landscaping-assistant as an active scrape target after deploy

Test Expectations

  • Manual: run kustomize build overlays/landscaping-assistant/prod/ and verify ServiceMonitor output has correct labels
  • Manual: after deploy, check Prometheus targets UI for the new scrape target
  • Run command: kustomize build overlays/landscaping-assistant/prod/

Constraints

  • Follow the same JSON patch style already used for Deployment and Service renaming in the prod overlay
  • ServiceMonitor endpoint port name must match the Service port name (http)
  • Do not change the base ServiceMonitor template

Checklist

  • PR opened
  • kustomize build renders correctly
  • No unrelated changes
  • project-landscaping-assistant -- project this affects
### Type Feature ### Lineage Standalone -- discovered during observability gap audit of landscaping-assistant deployment. ### Repo `ldraney/pal-e-deployments` ### User Story As an operator I want the ServiceMonitor selector to match the landscaping-assistant pod labels So that Prometheus can discover and scrape the app's metrics endpoint ### Context The base ServiceMonitor at `bases/standard/servicemonitor.yaml` uses `selector.matchLabels.app: app`. The landscaping-assistant prod kustomize overlay renames all Deployment and Service labels from `app` to `landscaping-assistant`, but has no corresponding patch for the ServiceMonitor. This means the ServiceMonitor selector never matches any pods, and Prometheus cannot scrape the app. The base kustomization also does not include ServiceMonitor in its resources list (it may be commented out or missing). ### File Targets Files the agent should modify or create: - `overlays/landscaping-assistant/prod/kustomization.yaml` -- add ServiceMonitor JSON patch to rename `matchLabels.app` to `landscaping-assistant` and metadata name to `landscaping-assistant` - `bases/standard/kustomization.yaml` -- ensure `servicemonitor.yaml` is listed in resources (currently missing) Files the agent should NOT touch: - `bases/standard/servicemonitor.yaml` -- base template should stay generic - `overlays/landscaping-assistant/dev/` -- dev uses its own resource set ### Acceptance Criteria - [ ] ServiceMonitor patch added to prod kustomization that sets `matchLabels.app: landscaping-assistant` - [ ] ServiceMonitor metadata name patched to `landscaping-assistant` - [ ] `kustomize build` renders the patched ServiceMonitor with correct selectors - [ ] Prometheus target page shows landscaping-assistant as an active scrape target after deploy ### Test Expectations - [ ] Manual: run `kustomize build overlays/landscaping-assistant/prod/` and verify ServiceMonitor output has correct labels - [ ] Manual: after deploy, check Prometheus targets UI for the new scrape target - Run command: `kustomize build overlays/landscaping-assistant/prod/` ### Constraints - Follow the same JSON patch style already used for Deployment and Service renaming in the prod overlay - ServiceMonitor endpoint port name must match the Service port name (`http`) - Do not change the base ServiceMonitor template ### Checklist - [ ] PR opened - [ ] kustomize build renders correctly - [ ] No unrelated changes ### Related - `project-landscaping-assistant` -- project this affects
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/landscaping-assistant#15
No description provided.