feat(observability)!: emit canonical http.client.request.duration via framework helper#78
Merged
Merged
Conversation
… framework helper Replace the direct meter call to the legacy snake_case histogram name with the framework's `recordCommerceMetric(...)` helper. The framework already emits canonical OTel SemConv names everywhere else; the VTEX and Shopify factories were the only producers still hardcoding the old name, splitting outbound-fetch samples between two metrics in the data lake. Also bump the @decocms/start peer dep min to >=6.6.0 (the version that exports `recordCommerceMetric` and finalised the canonical names). BREAKING CHANGE: the outbound commerce histogram is now emitted as `http.client.request.duration` (canonical) instead of `commerce_request_duration_ms`. Status is reported as `status_class` (2xx/3xx/4xx/5xx) instead of the full `status_code`. `cached` is now a boolean attribute. Dashboards / alerts querying the old metric name or labels need to be updated. Peer dep on `@decocms/start` is now `>=6.6.0`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
igoramf
approved these changes
Jun 11, 2026
igoramf
previously approved these changes
Jun 11, 2026
CI runs `bun install --frozen-lockfile`; the package.json bump in this PR wasn't reflected in bun.lock yet. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pre-existing lint errors in blog/__tests__/handlePosts.test.ts and blog/__tests__/loaders.test.ts surfaced on this PR because CI only runs on pull requests, not on direct pushes to main. Mechanical fix from `biome check --write` — no behavior change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ypecheck Pre-existing typecheck errors in blog/ surfaced on CI because the workflow only runs on pull requests, not pushes to main. Three classes of fix: - Add explicit `vitest` imports (`describe`/`it`/`expect`/`beforeEach`) to every `blog/__tests__/*.test.ts` — matches the convention used by all other test files in the repo. - Replace `blogPosts.toSorted(...)` with `[...blogPosts].sort(...)` in `blog/core/handlePosts.ts` — same non-destructive semantics, doesn't require bumping the tsconfig `lib` to ES2023. - Tighten the `ResolveSecretFn` stub in `mod.test.ts` to return `null` instead of `undefined` to satisfy `Promise<string | null>`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
hugo-ccabral
approved these changes
Jun 11, 2026
|
🎉 This PR is included in version 5.0.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
2 tasks
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
Replace the direct meter call to the legacy snake_case histogram name with the framework's
recordCommerceMetric(...)helper. The VTEX and Shopify outbound-fetch factories were the only producers still hardcodingcommerce_request_duration_ms, splitting outbound-fetch samples between two metrics in the data lake — the framework has been emitting canonical OTel SemConv names everywhere else.Also bumps the
@decocms/startpeer dep min to>=6.6.0(the version that exportsrecordCommerceMetricand finalised the canonical names).The release workflow (
feat!prefix) will cut a major bump —5.0.0. Customers tracking^4.xwill not auto-receive this change; they need to bump the range to pick it up.What changes for consumers
http.client.request.duration(canonical) instead ofcommerce_request_duration_ms.status_code(e.g."200","503") →status_class("2xx","5xx"). Lower cardinality, easier dashboards.cachedis now a boolean attribute (was a"true"/"false"string).@decocms/startis now>=6.6.0(was>=5.3.0).Dashboards and alerts querying the old metric name or the
status_codelabel need to be updated. None of the live*-tanstacksites consume those dashboards yet — the framework switched to canonical names in 6.6.x, so they were already drifting.Test plan
npm test— 662/662 pass.npm run typecheck— clean on touched files (pre-existing errors inblog/are unrelated, same count on plainmain).npm run linton touched files — only pre-existing warnings (unusedbeforeEach,anytypes in other files).@latestships, install onmiess-01-tanstack(and/orstorefront-tanstack) and confirm canonical metric appears in stats-lake underhttp.client.request.durationwithprovider=vtex, no leftover snake_case.Files touched
vtex/utils/instrumentedFetch.ts— switch torecordCommerceMetricshopify/utils/instrumentedFetch.ts— switch torecordCommerceMetricvtex/utils/__tests__/instrumentedFetch.test.ts— assert canonical name + new label shapeshopify/utils/__tests__/instrumentedFetch.test.ts— samevtex/client.ts— docstringREADME.md— docstringpackage.json— peer dep bump + devDep bump🤖 Generated with Claude Code
Summary by cubic
Switch VTEX and Shopify outbound fetch to emit canonical
http.client.request.durationviarecordCommerceMetric, replacingcommerce_request_duration_ms. Also fixes blog tests to unblock CI (add Vitest imports, replacetoSortedwith[...].sort, and tighten a test stub) with no behavior change.Migration
http.client.request.duration, usestatus_classinstead ofstatus_code, and treatcachedas a boolean.Dependencies
@decocms/startpeer to>=6.6.0(dev uses6.6.1); regenerated lockfile.Written for commit 81bd6d1. Summary will update on new commits.