Skip to content

Add CloudHub 2.0 support (fixes #220)#238

Open
ehstaya wants to merge 4 commits intomulesoft-catalyst:developfrom
ehstaya:feature/ch2-support
Open

Add CloudHub 2.0 support (fixes #220)#238
ehstaya wants to merge 4 commits intomulesoft-catalyst:developfrom
ehstaya:feature/ch2-support

Conversation

@ehstaya
Copy link
Copy Markdown

@ehstaya ehstaya commented Apr 24, 2026

Summary

Fixes #220 — the upstream ch collector calls the CH1 Runtime Manager API (/cloudhub/api/v2/applications) which returns zero deployments on CH2-only orgs, so the vCore metrics come back as zero.

This PR adds two new collectors:

  • ch2 — calls the AMC Application Manager v2 API (/amc/application-manager/api/v2/.../deployments) and fans out per-deployment detail calls to get application.vCores, target.replicas, and target.deploymentSettings.runtimeVersion. Each item is reshaped by a new adapter DWL into the existing CH1 object shape so downstream aggregation logic is untouched.
  • ps — reads Private Spaces via the Runtime Fabric API and produces a CH2-native networking block that replaces the CH1 VPC/VPN/DLB/static-IP fields (which don't exist on CH2).

Design

The key design decision is the adapter pattern: rather than rewriting the ~120-line aggregator DWL, the CH2 collector uses a small adapter DWL (ch2-to-ch1-adapter.dwl) to reshape CH2 deployment objects into the CH1 shape the aggregator already consumes. This keeps the Splunk/ELK/Tableau dashboard contracts intact and limits blast radius.

Three surgical edits were made to the aggregator XML + aggregation DWL — see commit "Wire ch2 and ps collectors into the aggregator".

What changed

  • New files: collector-cloudhub2.xml, collector-private-spaces.xml, api-call-cloudhub2.xml, api-call-private-spaces.xml, ch2-to-ch1-adapter.dwl, private-spaces-networking.dwl, docs/connected-app-scopes.md.
  • Modified: aggregator-platform-metrics.xml (3 edits), build-platform-metrics-aggregation.dwl (1 edit — networking block), app-common.yaml (+ cloudhub2/privatespaces API path blocks), collectors.raml (regex widened and underlying character-class bug fixed).

Config migration

Users on CH2-only orgs should:

  1. Assign the new Connected App scopes listed in docs/connected-app-scopes.md — notably Runtime Manager → Manage Applications, which is required for the per-deployment detail call.
  2. Change their collectors: property from ch to ch2. Never include both (would double-count).
  3. Optionally add ps if they have a paid org with Private Spaces.

Backward compatibility: the original ch collector is untouched and still works for CH1 orgs.

Testing

Validated end-to-end against an Anypoint Platform trial org deployed to CloudHub 2.0 Shared Space (Cloudhub-US-East-2). Observed accurate per-application vCore reporting matching what Runtime Manager shows, including correct handling of the 4.11.3:4e-java17 runtime version format.

MUnit tests for the new collectors are not included in this PR — flagged as a follow-up once maintainers confirm the approach. Happy to add them if desired as part of this review.

Checklist

  • Backward compatible with CH1 orgs (ch collector untouched)
  • No changes to existing aggregator DWL math (adapter pattern preserves contract)
  • Config documented (docs/connected-app-scopes.md)
  • MUnit tests added (flagged as follow-up; open to discussion)
  • Existing dashboards unaffected (adapter emits upstream shape)

ehstaya added 4 commits April 24, 2026 07:49
…ft-catalyst#220)

Upstream ch collector calls /cloudhub/api/v2/applications which returns
zero deployments on CH2-only orgs. This adds a ch2 collector that calls
the AMC Application Manager v2 API (list + per-deployment detail) and
reshapes each item into the CH1 object shape via a new adapter DWL so
the existing aggregation logic runs unchanged.

Fixes mulesoft-catalyst#220.
The CH1 networking fields (VPCs, VPNs, DLBs, static IPs) do not exist on
CH2. This adds a ps collector reading /runtimefabric/api/.../privatespaces
and a summariser DWL that emits a CH2-native networking block
(privateSpacesTotal, vpnConnectionsTotal, tgwAttachmentsTotal).

Trial and free-tier accounts with no Private Spaces receive an empty
summary without errors.
- Replace the ch collector choice with a ch2 choice in the scatter-gather.
- Append a ps route at scatter-gather index 10 so existing collector
  payload indices remain stable.
- Rewrite the runtimeManagerMetrics.cloudhub.networking block in the
  aggregation DWL to read from the ps route instead of CH1 entitlements
  fields that do not exist on CH2 orgs. CH1 legacy fields retained as
  null for dashboard schema stability.
- app-common.yaml: add cloudhub2.* and privatespaces.* API path blocks
  under anypoint.platform.apis.
- collectors.raml: fix a subtle bug in the collectors parameter pattern
  (the character class [ap|apc|...] matched any letter in the set, not
  the intended tokens). Rewrite as proper alternation and add ch2, ps,
  osv2 as valid tokens.
- docs/connected-app-scopes.md: new - documents the Connected App scopes
  required for ch2 and ps collectors, including what changes vs CH1.
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