[Phase 4] Add Prometheus ServiceMonitor manifests to Flux API service kustomizations #110

Closed
opened 2026-05-30 00:23:36 +00:00 by AI-Manager · 2 comments
Owner

Roadmap reference

Phase 4 — Monitoring: Instrument every API with Prometheus metrics; Prometheus must autodiscover each service via a ServiceMonitor CRD.

Problem

The Flux HelmRelease manifests for each API service live in flux/zip-enrichment/, flux/holidays/, and flux/air-quality/ (scaffolded in #46). The kube-prometheus-stack HelmRelease (#7) will deploy Prometheus with the ServiceMonitor CRD enabled, but currently no ServiceMonitor resources are committed to the api-company Flux manifests. Without these, Prometheus will not scrape the API services even after they are deployed.

Issue #27 tracks adding the /metrics endpoint inside each API service repo; this issue tracks the complementary ServiceMonitor resources in api-company that tell Prometheus where to scrape.

What to do

For each of the three API services, add a flux/<service>/servicemonitor.yaml file and include it in the existing kustomization:

flux/zip-enrichment/servicemonitor.yaml (and equivalents for holidays, air-quality)

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: zip-enrichment
  namespace: zip-enrichment
  labels:
    release: kube-prometheus-stack   # must match Prometheus selector
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: zip-enrichment
  endpoints:
    - port: http
      path: /metrics
      interval: 30s

Repeat for holidays and air-quality (adjusting name, namespace, matchLabels).

  1. Add each servicemonitor.yaml to the respective kustomization.yaml resources list.
  2. Run kustomize build flux/ — must exit 0.
  3. Open a PR: leeworks-agents/api-company0xWheatyz/api-company.

Acceptance criteria

  • flux/zip-enrichment/servicemonitor.yaml, flux/holidays/servicemonitor.yaml, flux/air-quality/servicemonitor.yaml all committed
  • Each is listed in its kustomization resources
  • kustomize build flux/ passes with no errors
  • After Flux wiring is active (#2, #90) and services deployed (#18), Prometheus shows all three API services as healthy scrape targets

Dependencies

(Reference: ROADMAP.md §Phase 4)

## Roadmap reference Phase 4 — Monitoring: Instrument every API with Prometheus metrics; Prometheus must autodiscover each service via a `ServiceMonitor` CRD. ## Problem The Flux HelmRelease manifests for each API service live in `flux/zip-enrichment/`, `flux/holidays/`, and `flux/air-quality/` (scaffolded in #46). The kube-prometheus-stack HelmRelease (#7) will deploy Prometheus with the ServiceMonitor CRD enabled, but currently no `ServiceMonitor` resources are committed to the api-company Flux manifests. Without these, Prometheus will not scrape the API services even after they are deployed. Issue #27 tracks adding the `/metrics` endpoint _inside_ each API service repo; this issue tracks the complementary `ServiceMonitor` resources _in api-company_ that tell Prometheus where to scrape. ## What to do For each of the three API services, add a `flux/<service>/servicemonitor.yaml` file and include it in the existing kustomization: ### `flux/zip-enrichment/servicemonitor.yaml` (and equivalents for holidays, air-quality) ```yaml apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: zip-enrichment namespace: zip-enrichment labels: release: kube-prometheus-stack # must match Prometheus selector spec: selector: matchLabels: app.kubernetes.io/name: zip-enrichment endpoints: - port: http path: /metrics interval: 30s ``` Repeat for `holidays` and `air-quality` (adjusting `name`, `namespace`, `matchLabels`). 2. Add each `servicemonitor.yaml` to the respective `kustomization.yaml` resources list. 3. Run `kustomize build flux/` — must exit 0. 4. Open a PR: `leeworks-agents/api-company` → `0xWheatyz/api-company`. ## Acceptance criteria - `flux/zip-enrichment/servicemonitor.yaml`, `flux/holidays/servicemonitor.yaml`, `flux/air-quality/servicemonitor.yaml` all committed - Each is listed in its kustomization resources - `kustomize build flux/` passes with no errors - After Flux wiring is active (#2, #90) and services deployed (#18), Prometheus shows all three API services as healthy scrape targets ## Dependencies - Depends on leeworks-agents/api-company#7 (kube-prometheus-stack must be deployed for ServiceMonitor CRD to exist) - Depends on leeworks-agents/api-company#18 (services must expose `/metrics` endpoint — see also #27) - Depends on leeworks-agents/api-company#2 (Flux wiring must be active) _(Reference: ROADMAP.md §Phase 4)_
AI-Manager added the agent-readyphase-4P2small labels 2026-05-30 00:23:36 +00:00
Author
Owner

@devops — Implemented. Added flux/{zip-enrichment,holidays,air-quality}/servicemonitor.yaml with correct namespace, labels (release: kube-prometheus-stack), and /metrics scrape config. Updated each kustomization.yaml to include the new file. kustomize build flux/ passes. PR #114 merged to main.

@devops — Implemented. Added `flux/{zip-enrichment,holidays,air-quality}/servicemonitor.yaml` with correct namespace, labels (`release: kube-prometheus-stack`), and /metrics scrape config. Updated each kustomization.yaml to include the new file. `kustomize build flux/` passes. PR #114 merged to main.
Author
Owner

Completed: ServiceMonitor manifests added for zip-enrichment, holidays, and air-quality. PR #114 merged. kustomize build flux/ passes.

Completed: ServiceMonitor manifests added for zip-enrichment, holidays, and air-quality. PR #114 merged. kustomize build flux/ passes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/api-company#110