Repository navigation
feat(router): tag oauth_action counters with destinationId and count AUTH_STATUS_INACTIVE (PRO-5946) - #7477
Merged
Conversation
1 task done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7477 +/- ##
==========================================
+ Coverage 85.05% 85.09% +0.03%
==========================================
Files 632 633 +1
Lines 62877 62930 +53
==========================================
+ Hits 53479 53548 +69
+ Misses 9395 9379 -16
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tipped73
force-pushed
the
feat/pro-5946-oauth-destination-id-tag
branch
2 times, most recently
from
October 15, 2026 08:56
7380e5c to
68c8b49
Compare
1 task done
atzoum
reviewed
Oct 16, 2026
tipped73
force-pushed
the
feat/pro-5946-oauth-destination-id-tag
branch
5 times, most recently
from
October 19, 2026 10:56
0974f1c to
bea137a
Compare
atzoum
reviewed
Oct 20, 2026
atzoum
left a comment
Contributor
There was a problem hiding this comment.
Ginkgo is legacy in this repo, so let's not add to it. Could you rewrite them as plain func TestXxx(t *testing.T) with testify require, like you did in oauth_stats_test.go? The client-wiring test can go in its own _test.go file next to the suite.
Since this was most likely agent-written, please also add the rule to AGENTS.md so the next one doesn't repeat it. Under Never Do:
- Write new tests with Ginkgo/Gomega: use plain `testing` + testify (`require`/`assert`). Existing Ginkgo suites are legacy; don't add new `_test.go` files that import `github.com/onsi/ginkgo` and try to avoid adding `Describe`/`It` blocks to existing ones.
tipped73
force-pushed
the
feat/pro-5946-oauth-destination-id-tag
branch
from
October 20, 2026 07:42
bea137a to
c592184
Compare
Contributor
Author
1 task done
atzoum
approved these changes
Oct 20, 2026
atzoum
self-requested a review
October 20, 2026 13:19
Contributor
|
@tipped73 please rebase the branch |
kuldeep0020
approved these changes
Oct 20, 2026
tipped73
force-pushed
the
feat/pro-5946-oauth-destination-id-tag
branch
from
October 20, 2026 13:29
85fcc5c to
5e7f5e4
Compare
atzoum
approved these changes
Oct 20, 2026
tipped73
added a commit
that referenced
this pull request
Oct 20, 2026
…holds a newer secret (PRO-5947) (#7478) # Description When a customer re-authorizes a destination, config-backend stores a new secret and bumps the account's `secretVersion`, but a pod keeps using the token it cached until it expires or a delivery fails with the refresh-token class. The inactive (403) class never re-asks (INT-6859; spec rudderlabs/rudder-specs#193, LLD 3.9). The handler now re-fetches a cached token when the control plane's version for the account is strictly newer than the token's own, which it parses from the token response. A token with version 0 is never superseded, and the re-fetch is a plain fetch, not a forced refresh. How the version reaches the handler, with no new goroutine and no process-wide state. This is the design from #7492, cherry-picked here as its author's commit; the second commit only adds tests and doc lines: - Router and regulation worker: every job carries a fresh destination from their own config loop, with the account attached, so the transport copies `GetSecretVersion(flow)` into the token params. - Batch router: its async managers keep their destination until the revision changes, which a re-authorization does not do. So the batch router fills an account-to-version map inside its existing config loop and hands it to them as a `SecretVersionProvider`. The map is filled from the delivery account config-backend attaches to each async destination. - Handler: compares the cached version against the larger of the two. Tests: `GetSecretVersion`; the transport passing the version for both flows; the batch router provider; the handler suite (fetch once then serve from cache for the router param, the provider, a stale snapshot and a caller newer than the provider; cached when same version, older config, version 0 or no version; cold cache keeps the response's version); and the response parsing. Build, vet, golangci-lint and `go test -race ./services/oauth/...` are green. On mini, bumping the account's version while the pod held its token made the branch log the superseded token and fetch once; the stock image kept the old token. Related: #7477 touches the same handler file; no conflicts today. ## Linear Ticket https://linear.app/rudderstack/issue/PRO-5947/rudder-server-re-fetch-the-cached-oauth-token-when-the-control-plane ## Security - [x] The code changed/added as part of this pull request won't create any security issues with how the software is being used. --------- Co-authored-by: Aris Tzoumas <[email protected]>
…UTH_STATUS_INACTIVE The Integration Accounts Auth Alerts rule (rudderlabs/rudder-specs#193, LLD 3.1) is keyed by destination, but oauth_action_request only carried the account id. The three oauth_action counters now carry destinationId through a second tag set on OAuthStatsHandler; the latency histograms keep their per-account label set. AUTH_STATUS_INACTIVE, classified in the transport and silent until now, is counted on oauth_action_request. No delivery behaviour changes. Linear: PRO-5946
The inactive class is decided in the transport but the metric belongs to the handler, which owns the stats sink and every other oauth_action_* sample. The transport now calls OAuthHandler.ReportAuthStatusInactive and the transport args no longer expose their stats sink. The breaker wrapper forwards the report outside its circuits.
The handler flow was pinned to delivery at construction and nothing could change it, so the regulation worker, which builds its client for the delete flow, emitted every oauth_action_* sample with flowType="delivery". A WithRudderFlow option is added and NewOAuthHttpClient passes its own flow, so handler and transport agree.
oauthStats, oauthStatsHandler, newOAuthStatsHandler and oauthV2StatPrefix are package internals; nothing outside services/oauth/v2 uses them.
…ts comments The emitted tag keeps its name, id. Comments describe behaviour only: no revision history, no series counts, no downstream narrative. The authErrCategory comment now states the real value for the inactive action.
The refresh-failure tag test, the inactive-class transport table and the delete-flow client test now use testing and testify, with the same cases and assertions.
tipped73
force-pushed
the
feat/pro-5946-oauth-destination-id-tag
branch
from
October 20, 2026 17:15
5e7f5e4 to
243888d
Compare
This was referenced Oct 26, 2026
Closed
Merged
itsmihir
pushed a commit
that referenced
this pull request
Oct 26, 2026
🤖 I have created a release *beep* *boop* --- ## [1.92.0-rc.1](v1.91.0...v1.92.0-rc.1) (2026-10-26) ### Features * **processor:** pyt test-pod deployer sets PYT_MODE=test ([#7506](#7506)) ([a050ed6](a050ed6)) * **processor:** reset the per-workspace pyt client on 421 ([#7494](#7494)) ([83db4d6](83db4d6)) * **router:** re-fetch the cached OAuth token when the control plane holds a newer secret (PRO-5947) ([#7478](#7478)) ([742779d](742779d)) * **router:** tag oauth_action counters with destinationId and count AUTH_STATUS_INACTIVE (PRO-5946) ([#7477](#7477)) ([0e15eb4](0e15eb4)) ### Bug Fixes * flaky TestDrainConfigRoutine failing with "database is closed" ([#7489](#7489)) ([9baa89f](9baa89f)) ### Miscellaneous * block new ginkgo/gomega usage in tests ([#7502](#7502)) ([e1c9d38](e1c9d38)) * bump dependency versions ([#7522](#7522)) ([1067ff4](1067ff4)) * enforce errors.AsType and point CLAUDE.md at AGENTS.md ([#7521](#7521)) ([5c7e088](5c7e088)) * go 1.27.3 ([#7516](#7516)) ([3c240a3](3c240a3)) * migrate debugger, services, async destination and utils tests from ginkgo to testify ([#7503](#7503)) ([1a8c85a](1a8c85a)) * migrate gateway, rsources, reporting, batchrouter and manager tests from ginkgo to testify ([#7507](#7507)) ([ffdd505](ffdd505)) * remove ginkgo and gomega from tests ([#7508](#7508)) ([d3e7e0f](d3e7e0f)) --- 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>
itsmihir
pushed a commit
that referenced
this pull request
Oct 27, 2026
🤖 I have created a release *beep* *boop* --- ## [1.92.0](v1.91.0...v1.92.0) (2026-10-26) ### Features * **processor:** pyt test-pod deployer sets PYT_MODE=test ([#7506](#7506)) ([a050ed6](a050ed6)) * **processor:** reset the per-workspace pyt client on 421 ([#7494](#7494)) ([83db4d6](83db4d6)) * **router:** re-fetch the cached OAuth token when the control plane holds a newer secret (PRO-5947) ([#7478](#7478)) ([742779d](742779d)) * **router:** tag oauth_action counters with destinationId and count AUTH_STATUS_INACTIVE (PRO-5946) ([#7477](#7477)) ([0e15eb4](0e15eb4)) ### Bug Fixes * flaky TestDrainConfigRoutine failing with "database is closed" ([#7489](#7489)) ([9baa89f](9baa89f)) ### Miscellaneous * block new ginkgo/gomega usage in tests ([#7502](#7502)) ([e1c9d38](e1c9d38)) * bump dependency versions ([#7522](#7522)) ([1067ff4](1067ff4)) * enforce errors.AsType and point CLAUDE.md at AGENTS.md ([#7521](#7521)) ([5c7e088](5c7e088)) * go 1.27.3 ([#7516](#7516)) ([3c240a3](3c240a3)) * migrate debugger, services, async destination and utils tests from ginkgo to testify ([#7503](#7503)) ([1a8c85a](1a8c85a)) * migrate gateway, rsources, reporting, batchrouter and manager tests from ginkgo to testify ([#7507](#7507)) ([ffdd505](ffdd505)) * remove ginkgo and gomega from tests ([#7508](#7508)) ([d3e7e0f](d3e7e0f)) --- 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>
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.
Description
The Integration Accounts Auth Alerts feature (spec: rudderlabs/rudder-specs#193, LLD 3.1) needs two things from the OAuth metrics that they do not provide today: which destination a token failure belongs to, and a count for the "account inactive" class, which never emitted anything.
What changes:
oauth_action_request,oauth_action_request_sentandoauth_action_proactive_token_refreshget adestinationIdtag. The two latency histograms keep their per-account labels: a token call is per account, and nothing reads latency per destination.AUTH_STATUS_INACTIVEis now counted onoauth_action_request. The transport still decides the class from the destination's response and still answers 400, but it reports it through a newOAuthHandler.ReportAuthStatusInactive, so the metric stays with the handler. The breaker wrapper forwards the report without touching its circuits.delivery, so the regulation worker's token metrics were labelled as deliveries. AddedWithRudderFlow, andNewOAuthHttpClientnow passes its own flow.oauthStats,oauthStatsHandler,newOAuthStatsHandlerandoauthV2StatPrefixare unexported, and theidfield is renamed toaccountID. The emitted tag is stillid.No new metric names, no delivery behaviour change. Counter cardinality goes from one series per (account, reason) to one per (account, destination, reason): 322 series for 84 accounts on US multi-tenant today.
Known and out of scope: the response classifiers take the first recognised category, so a
REFRESH_TOKENentry ahead of an inactive one hides it; Bing Ads uploads through the SDK's own HTTP client, so an inactive verdict from Bing never reaches this counter.Tests: tag sets, the handler method for both flows, the breaker pass-through with the circuit open, a transport table (delivery and delete inactive, inactive without an augmenter,
REFRESH_TOKENand classifier errors emit nothing), and a delete-flow client built the production way. Build, vet, golangci-lint andgo test -race ./services/oauth/...are green, and both fixes were checked red without them. On mini the inactive sample shows up with all its labels.Related: #7478 (re-fetch the token on re-authorization) touches the same handler file.
Linear Ticket
https://linear.app/rudderstack/issue/PRO-5946/rudder-server-destinationid-tag-on-the-oauth-counters-and-count-auth
Security