Repository navigation
feat(router): read transformerProxy from transformer features before env - #7337
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #7337 +/- ##
==========================================
+ Coverage 79.88% 80.30% +0.42%
==========================================
Files 612 615 +3
Lines 68673 69144 +471
==========================================
+ Hits 54856 55528 +672
+ Misses 10599 10350 -249
- Partials 3218 3266 +48 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The router decided proxy delivery solely from Router.<DEST>.transformerProxy, an env key populated from serverConfigOverride across 29 hand-maintained YAML files in rudderstack-operator and rudder-devops. Nothing tied it to the transformer image that implements the proxy handler, so the two drifted per environment — including 8 destinations enabled only in MT-US and two keys mis-indented under `throttler:` that rudder-server never reads at all. The transformer now publishes a transformerProxy capability map on /features. transformerProxyEnabled treats it as authoritative: a destination the transformer declares is proxied without the env being consulted. The env stays the enablement path for everything not declared — destinations still rolling out, and those with no proxy handler of their own (delivered by the generic handler), which can never appear in the capability map. It is an OR rather than an override because getRouterConfigKeys resolves Router.<DEST>.transformerProxy then Router.transformerProxy, and that second key is set to false in the operator base values.yaml. It is therefore always present for every destination, so any "env wins when set" scheme would have that global false silently beat the capability fleet-wide. The features service is read on each call rather than cached, matching how RouterTransform, Regulations, TransformerProxyVersion and SourceTransformerVersion are all consumed. That keeps it live: upgrading the transformer to an image which newly declares a destination takes effect on the next features poll rather than at the next rudder-server restart, which matters because the two services deploy independently. On a representative 4.3KB payload a gjson lookup is 823ns, a few microseconds per job on a path dominated by a network round trip. All five reads on the delivery path go through the accessor, as does newBarrierFn's metadata read. No behaviour change today: every destination the transformer declares already has the env set to true. Version skew is safe both ways — an older transformer omits the map and the env decides exactly as before, and an older rudder-server never reads it. createTestWorker gets the noop features service; it declares nothing, so Router.<DEST>.transformerProxy keeps deciding there. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HbD4xkXp922cKx6zAVQnbg
916a91d to
7040998
Compare
| // The transformer's own declaration wins: a destination it declares is proxied without consulting | ||
| // the environment at all. Router.<DEST>.transformerProxy remains the enablement path for every | ||
| // destination the transformer has not declared — those still rolling out, and those with no proxy | ||
| // handler of their own, which are delivered by the generic handler and so can never appear in the |
There was a problem hiding this comment.
the one via generic handler also need to be advertised via transformer capability rather than environment variable
There was a problem hiding this comment.
Updated the comment
…Enabled The comment explained which destinations can appear in the transformer's capability map in terms of whether they have a proxy handler of their own or fall back to the generic handler. That is transformer-side detail, and it is not something rudder-server knows or should encode: all it consumes is the value /features returns for this destination type. Leaves the two things that are server-side semantics — that the declaration takes precedence over Router.<DEST>.transformerProxy, and why this reads the features service per call instead of caching. Comment only, no behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_011yjk6jXLM3R7uLNr8fLV6p
atzoum
left a comment
There was a problem hiding this comment.
The features service design has quite a few weaknesses, and this is a good opportunity to fix most of them:
-
Features caching: parse
/featuresonce into an immutable snapshot behind anatomic.Pointerand swap only when the body differs (bytes.Equalis enough). This will fix the current race ont.featuresand, more importantly, will take gjson out of the hot path. -
Fix the
SourceTransformerVersion/isInitializedinconsistency on the first poll by introducing an internal method. Right now the deprecation check inmakeFeaturesFetchCallis a no-op, sincewaitChancloses only after it returns: the panic fires one poll interval late, afterWait()has already released the gateway, router and processor. -
makeFeaturesFetchCallshould return anerror, not a bool. -
Non-200/404 responses shouldn't be treated as success. Today a transformer 500
closeswaitChanand the server proceeds on the hardcoded defaults believing
features were fetched. -
defaultTransformerFeaturesshould not be invalid JSON as it is now (trailing
comma). Let's add a test to guard it.
- parse /features once into an immutable snapshot behind an atomic.Pointer, swapping only when the body differs; removes the data race on the features field and takes gjson out of the hot path - run the v0 deprecation check against every fetched snapshot before it is published and before Wait() releases, so a deprecated transformer panics on the first poll instead of one interval late - makeFeaturesFetchCall returns an error instead of a retry bool - treat any non-200 response (404 included) as a failure so the server no longer proceeds on defaults believing features were fetched - define defaultTransformerFeatures as a typed struct literal instead of a JSON string, making an invalid default impossible - extract retry handling into fetchWithRetries to simplify the sync loop Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GHw4awCvKV77ZFbkGLjAqa
golangci-lint forbids encoding/json.Unmarshal in favour of jsonrs. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KztEWQc216jBXVz8VJR65V
- SourceTransformerVersion: drop the isInitialized() guard; the default snapshot already advertises v2, so the guard was redundant. The helper itself goes with it, as it had no other production caller. - Restore HTTP 404 handling: transformer images without a /features endpoint serve the hardcoded defaults and the fetch counts as successful, as before. - fetchWithRetries: use cenkalti/backoff with an exponential backoff capped at the poll interval, retrying perpetually until ctx is cancelled. FeaturesRetryMaxAttempts is now unused and removed. - syncTransformerFeatureJson: close waitChan when the context is cancelled before the first successful fetch, so a shutdown mid- initialisation doesn't leave Wait() callers blocked forever. - makeFeaturesFetchCall: take a context and honour it on the request. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UyJk2fpVz3vNpWR5cHR1d7
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.1](v1.86.0...v1.87.0-rc.1) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.2](v1.86.0...v1.87.0-rc.2) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.3](v1.86.0...v1.87.0-rc.3) (2026-09-14) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.87.0-rc.4](v1.86.0...v1.87.0-rc.4) (2026-09-15) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **batchrouter:** retry failed async manager initialization ([#7374](#7374)) ([974d383](974d383)) * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * singer-protocol sources filtered destination config for source type cloud instead of cloudSource ([#7389](#7389)) ([f48c997](f48c997)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.87.0](v1.86.0...v1.87.0) (2026-09-15) ### Features * backend config shadow mode ([#7340](#7340)) ([4898165](4898165)) * bump rudder-go-kit and go modules to Go 1.27.1 ([#7345](#7345)) ([8d95c68](8d95c68)) * **router:** read transformerProxy from transformer features before env ([#7337](#7337)) ([e8f0ea6](e8f0ea6)) ### Bug Fixes * **batchrouter:** retry failed async manager initialization ([#7374](#7374)) ([974d383](974d383)) * **router:** redact credentials from destination URLs in failure responses ([#7372](#7372)) ([14659bf](14659bf)) * **router:** request fails with unexpected use of stub RoundTripper error ([#7386](#7386)) ([2ff491f](2ff491f)) * singer-protocol sources filtered destination config for source type cloud instead of cloudSource ([#7389](#7389)) ([f48c997](f48c997)) * **warehouse:** instrument the clickhouse v2 load path ([#7355](#7355)) ([4d743db](4d743db)) * **warehouse:** pass temporary credentials to the clickhouse v2 s3 copy engine ([#7353](#7353)) ([4d743db](4d743db)) * **warehouse:** retire idle clickhouse v2 connections ([#7352](#7352)) ([4d743db](4d743db)) * **warehouse:** retry a failed clickhouse v2 block ([#7354](#7354)) ([4d743db](4d743db)) ### Miscellaneous * log the candidate error when a backend config shadow sample fails to fetch ([#7383](#7383)) ([eaa9b61](eaa9b61)) * **processor:** assemble side-PU report metrics at end of preprocess stage ([#7346](#7346)) ([4540876](4540876)) * sync release v1.86.0 to main branch ([#7356](#7356)) ([6868c6c](6868c6c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
What
The router now asks the transformer whether a destination is generally available for proxy delivery, and only consults
Router.<DEST>.transformerProxywhen the transformer has not declared it.Pairs with rudderlabs/rudder-transformer#5546, which publishes the
transformerProxycapability map on/features. Either side can merge first.Behaviour change
None today. Every destination the transformer declares already has the env set to
true, so the result is identical. Version skew is safe in both directions: an older transformer omits the map,gjsonreturns false, and the env decides exactly as before; an older rudder-server never reads the map.The change lands when the env entries are deleted from operator/devops in a follow-up and delivery keeps working.
🤖 Generated with Claude Code