Skip to content

feat: convert resource metrics to ResourceMetricsPolicy#65

Open
scotwells wants to merge 6 commits intomainfrom
feat/resource-metrics-policy-conversion
Open

feat: convert resource metrics to ResourceMetricsPolicy#65
scotwells wants to merge 6 commits intomainfrom
feat/resource-metrics-policy-conversion

Conversation

@scotwells
Copy link
Copy Markdown
Contributor

@scotwells scotwells commented Apr 19, 2026

Summary

Replaces the CustomResourceStateMetrics KSM sidecar config (config/resource-metrics/) with the ResourceMetricsPolicy CRD, and removes the old config entirely.

  • Deletes config/resource-metrics/ (KSM ConfigMap approach)
  • Adds config/components/resource-metrics/ as an optional kustomize component (kind: Component) — opt in via components:, not included in the default overlay
  • Uses forEach array iteration (added in a recent resource-metrics release) to restore full per-condition and per-sink cardinality

Converted metrics

Family name Notes
datum_cloud_telemetry_export_policy_info Info-style gauge; labels: name, namespace, uid
datum_cloud_telemetry_export_policy_created Unix creation timestamp via double(timestamp(...).getSeconds())
datum_cloud_telemetry_export_policy_status_condition One series per condition type via forEach: object.status.conditions; labels: condition, reason, status
datum_cloud_telemetry_export_policy_sink_status_condition One series per sink via forEach: object.status.sinks; labels: sink_name, condition

Test plan

  • Verify the ResourceMetricsPolicy CRD is installed in the target cluster.
  • Apply config/components/resource-metrics/ with kustomize and confirm the policy is accepted without validation errors.
  • Confirm all four metric families appear in VictoriaMetrics/Prometheus scrape targets with the expected label cardinality.
  • Confirm status_condition emits one series per condition type (not just Ready).
  • Confirm sink_status_condition emits one series per sink with a sink_name label.

🤖 Generated with Claude Code

scotwells and others added 5 commits April 19, 2026 15:06
Converts the CustomResourceStateMetrics config for ExportPolicy to the
new ResourceMetricsPolicy CRD format using CEL expressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rceMetricsPolicy

Deletes config/resource-metrics/ (KSM sidecar ConfigMap approach) and
wires config/default/kustomization.yaml to the new
config/resource-metrics-policies/ directory instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Converts config/resource-metrics-policies/ from a Kustomization to a
Component (v1alpha1) so it can be opted into via a components: entry
rather than being included in the default overlay.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces the single-series workarounds with forEach iteration now that
the resource-metrics service supports array field paths:

- status_condition: iterates object.status.conditions, emitting one
  series per condition type with condition/reason/status labels.
- sink_status_condition: iterates object.status.sinks, emitting one
  series per sink (sink_name label) indicating Ready condition state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ce-metrics/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scotwells scotwells requested review from a team and JoseSzycho May 5, 2026 22:14
@scotwells scotwells marked this pull request as ready for review May 5, 2026 22:15
@scotwells scotwells enabled auto-merge May 5, 2026 22:15
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.

1 participant