Add CloudHub 2.0 support (fixes #220)#238
Open
ehstaya wants to merge 4 commits intomulesoft-catalyst:developfrom
Open
Add CloudHub 2.0 support (fixes #220)#238ehstaya wants to merge 4 commits intomulesoft-catalyst:developfrom
ehstaya wants to merge 4 commits intomulesoft-catalyst:developfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #220 — the upstream
chcollector 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 getapplication.vCores,target.replicas, andtarget.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
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.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:
docs/connected-app-scopes.md— notably Runtime Manager → Manage Applications, which is required for the per-deployment detail call.collectors:property fromchtoch2. Never include both (would double-count).psif they have a paid org with Private Spaces.Backward compatibility: the original
chcollector 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-java17runtime 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
chcollector untouched)docs/connected-app-scopes.md)