refactor(metrics): migrate metrics tiles and logsmap to cc-api-client#1755
Merged
Conversation
31bf4f7 to
66a30e9
Compare
Contributor
|
🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/metrics/warp10-migration-v4/index.html. This preview will be deleted once this PR is closed. |
florian-sanders-cc
requested changes
Jun 1, 2026
Contributor
florian-sanders-cc
left a comment
There was a problem hiding this comment.
A small fix but apart from that, LGTM! 👍
09dcfd4 to
fc77c0d
Compare
The shared `CcApiClient` utility now lives next to `i18n.js` and `smart-manager.js` as a top-level library that components import directly. It needs to ship as its own entry in the published bundle so consumers can import it without pulling in a specific component chunk.
Part of the migration away from the legacy clients toward the typed `cc-api-client` command API. Swaps `getOrganisationApplicationMetrics` for `GetMetricsCommand`, which already returns metrics keyed by name with normalized timestamps, removing the need for the local `extractMetric` helper and the `RawMetric` type. Also fix the documentation from `/v4/metrics/...` to `/v4/stats/...` to match the new API endpoint.
…-api-client Part of the Warp10 → cc-api-client migration. Replaces the two-step Warp10 token fetch + Warpscript execution with a single `GetStatusCodeDistributionCommand`, which also drops the client-side filtering of non-standard status codes (the new client handles it via `excludeNonStandardStatusCodes`).
Part of the Warp10 → cc-api-client migration. `cc-tile-requests` didn't expose a smart binding yet; this adds one backed by `GetStatusCodeDistributionCommand` so the tile can be wired into the demo and console without going through Warpscript.
Continues the Warp10 migration by wiring `cc-logsmap` to the new client: `GetHeatMapCommand` for the `heatmap` mode and `StreamRequestsCommand` for the live `points` mode. The heat map aggregates into hourly buckets, so its response is byte-identical for the rest of the current hour — cached until the next hour boundary plus a 2-minute margin to absorb ingestion lag.
Now that cc-tile-metrics, cc-tile-status-codes, cc-tile-requests and cc-logsmap fetch their data through the new cc-api-client, nothing in the repo still calls sendToWarp. Drop the helper, the Warp10ApiConfig type, and the WARP_10_HOST plumbing in the storybook auth plugin so the API config surface only carries what is actually used.
fc77c0d to
2b69684
Compare
florian-sanders-cc
approved these changes
Jun 2, 2026
Contributor
|
🔎 The preview has been automatically deleted. |
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.
Context
Continues the migration away from the legacy
@clevercloud/clientWarp 10 access pathtoward the new typed
cc-api-client. Once every consumer ofsendToWarpis gone, we candrop the Warpscript plumbing and the
WARP_10_HOSTconfig surface, which is what thisbranch achieves for the metrics tiles and the logs map.
Changes
cc-tile-metrics: smart binding now usesGetMetricsCommand. The new response isalready keyed by metric name with normalized timestamps, so the local
extractMetrichelper and the
RawMetrictype are gone. Doc fixed from/v4/metrics/...to/v4/stats/...to match the endpoint.cc-tile-status-codes: replaces the two-step Warp 10 token + Warpscript exec with asingle
GetStatusCodeDistributionCommand. Client-side filtering of non-standard codesis dropped — the new client exposes
excludeNonStandardStatusCodes.cc-tile-requests: adds the smart binding it never had, backed byGetStatusCodeDistributionCommand, so it can be wired into the demo and consolewithout going through Warpscript.
cc-logsmap: adds a smart binding usingGetRequestsCommandforheatmapmode andStreamRequestsCommandfor the livepointsmode.send-to-api: removessendToWarp, theWarp10ApiConfigtype, and theWARP_10_HOSTplumbing in the storybook auth plugin. The API config surface now onlycarries what is actually used.
cc-api-client.jsis added as a rollup main entry so consumers can import itwithout pulling in a specific component chunk.
Implementation notes
For
cc-logsmapheatmap mode, the response is byte-identical within an hour-alignedbucket, so the current hour is cached until the next hour boundary plus a 2-minute
margin — same cadence the previous Warpscript query had, but expressed at the client
level instead of inside the script.
For
cc-tile-status-codes, dropping the local filter changes a subtle behavior: codesoutside the standard ranges used to be silently dropped after fetch. The new flag
asks the client to omit them upstream, so the tile shows exactly what the client returns.
How to review
src/lib/send-to-api.jsand the storybook plugin to confirm nothing elsein the tree still references
sendToWarp/WARP_10_HOST.*.smart.jsfiles in this order:cc-tile-metrics→cc-tile-status-codes→cc-tile-requests→cc-logsmap.Each one is independent; reading them in that order matches increasing complexity
(single command → two commands + streaming).
.smart.mddocs next to each component were updated in lockstep — worth a passto check the example payloads match the new command outputs.
real account and confirm the tiles render the same data as on
master.1-2 approvals from anyone on the team.