Log cache status and deliveryZonesHash presence for intsch calls#561
Log cache status and deliveryZonesHash presence for intsch calls#561LucasTornai wants to merge 2 commits into
Conversation
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
| path: string, | ||
| options?: FacetsOptions | ||
| ) { | ||
| public async facets(params: FacetsArgs, path: string, shippingHeader?: string[], hasDeliveryZonesHash?: boolean) { |
There was a problem hiding this comment.
I believe you meant to target the intsch client, this one is supposed to be dead already
There was a problem hiding this comment.
Good catch — you're right, this was targeting the deprecated Biggy client. The branch also turned out to be based on a very stale snapshot of main (~117 commits behind), so I restarted the work from current main and moved the cache-status logging to intsch (node/clients/intsch/index.ts) instead, using segmentParams.deliveryZonesHash for the delivery-zones signal since that's how it already flows into facets/productSearch there.
Restarted this off latest main: the previous commit targeted intelligent-search-api.ts, which is the deprecated Biggy client and no longer where product-search/facets traffic actually goes (per PR #561 review). intsch is now the live client, so log router-cache status (HeaderKeys.ROUTER_CACHE) and whether the request's segment carried a deliveryZonesHash there instead.
1d0d012 to
d1b7b07
Compare
Avoid logging every product-search/facets call at full volume; 10% sampling matches the existing Math.random() < 0.1 pattern already used for the migration log in services/productSearch.ts.
Summary
product-searchandfacetscalls tointsch(the live Intelligent Search client) were served from the router cache, plus whether the request's segment carried adeliveryZonesHash.x-router-cacheresponse header (HeaderKeys.ROUTER_CACHE) — the same signal@vtex/apiuses internally to tag tracing spans.Details
node/clients/intsch/index.ts:facets()andproductSearch()now usegetRawinstead ofgetto access response headers, and log{ message: 'IntelligentSearch cache status', route, cacheHit, hasDeliveryZonesHash }viactx.vtex.logger.info.deliveryZonesHashpresence is read fromsegmentParams, which is how it already flows into both methods.Test plan
yarn lint(tsc --noEmit) passesyarn test— 179 passed / 3 skipped, no regressionsEdit: this PR previously targeted the deprecated
intelligent-search-api.ts(Biggy) client — restarted from latestmainand moved the logging tointschper review feedback below.