Skip to content

Limitation: Projection Fails for Non-Scalar Fields #43

@rouzbehsedighi

Description

@rouzbehsedighi

When trying to project the status.conditions field from a custom resource (like a Crossplane Subaccount), the operator fails with the following error:

failed to record metric value(s): errors during metric recording: [projection error for readyStatus: %!w(<nil>)]

Even when accessing a specific field like:

fieldPath: "status.conditions[0].status"

Expected behavior

Support projections that return values from:

  • JSON arrays with index notation (e.g., status.conditions[0].status)

  • Filtered JSONPath (e.g., status.conditions[?(@.type=='Ready')].status)

Reproduction

Here is an example Metric resource that causes the issue:

apiVersion: metrics.openmcp.cloud/v1alpha1
kind: Metric
metadata:
  name: test-subaccount
spec:
  name: test-subaccount
  interval: 1m
  target:
    kind: Subaccount
    group: account.btp.sap.crossplane.io
    version: v1alpha1
  projections:
    - name: readyStatus
      fieldPath: "status.conditions[0].status"

Metadata

Metadata

Assignees

Labels

area/providerAll Provider related issuesgood first issueNew to this repo? This is a good place to startkind/bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions