Skip to content

fix(auth): Google's signing-key fetch shows up in sign-in traces - #309

Merged
PiquelChips merged 3 commits into
mainfrom
fix/google-jwks-client-span
Nov 2, 2026
Merged

PiquelChips merged 3 commits into
mainfrom
fix/google-jwks-client-span

Conversation

@PiquelChips

@PiquelChips PiquelChips commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Signing in with Google left a gap in the trace: every GitHub and Google call had a client span except the fetch of Google's signing keys. That fetch goes through the Rust SDK's KeyCache, not auth's send_traced(), so it never showed up.

Now the SDK sends every request in an http.client span of its own, with the same attributes as send_traced(): method, host, status and duration. It never records the path, query or headers. The span sits under the request that needed the keys. The SDK still depends only on tracing, not on auth's telemetry crates, so any app using it gets these spans too. Auth's filter now lets piquel_auth spans through.

The span goes in the SDK rather than around auth's call to keys.verify(), because verify() only sometimes reaches the network. A span there would also appear when the cached keys were used.

Proof: a new test, google_key_fetch_is_a_client_span_of_its_request, fetches keys from a URL with a secret query string. It checks that the span is a child of the request's span, has method, host and status, exports the status as an integer like send_traced() does, and contains no path or query. It fails without the SDK change and passes with it. cargo test -p piquel-auth and clippy are clean.

Reviewed with review-loop: 2 rounds with 2× GPT-6.1 Sol and Claude Opus 5.5. Verdict: approved

Note

Written by Claude Opus 5.5 in Claude Code and reviewed by GPT-6.1 Sol and Claude Opus 5.5 (via T3 Code)

🤖 Generated with Claude Code

Authentication SDK

The SDK now creates an http.client tracing span for each outbound request. The span records the HTTP method, host, and response status as an integer. It does not record the request path or query. The SDK records ERROR for 4xx and 5xx responses and for exchange errors.

The span is emitted when the SDK sends the request, including when KeyCache fetches Google signing keys. It is therefore a child of the span for the request that needed those keys, and appears only when the keys are fetched over the network. The SDK now depends on tracing unconditionally instead of enabling it through the axum feature.

Tests

A federation test checks that a Google signing-key fetch creates a child GET client span. It checks the integer status and server address attributes, and confirms that the path and query are absent.

Auth service telemetry

The auth service telemetry filter now includes piquel_auth=info, allowing the SDK spans through the configured filter.

Documentation

The SDK documentation describes the client span and its recorded attributes. The telemetry guidance clarifies that the Rust SDK creates spans for outbound requests, including Google signing-key fetches through KeyCache.

Validation

The supplied context reports that cargo test -p piquel-auth and clippy pass. It also reports that the new test fails without the SDK change and passes with it. Current review finding counts were not supplied.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e6e6e42-4d93-4f6f-b8ff-57c5e11eea0d
Commits

Reviewing files that changed from the base of the PR and between 6d508e6 and 73a4711.

Files selected for processing: 6
  • apps/auth-service/src/federation/tests.rs
  • apps/auth-service/src/lib.rs
  • crates/auth-sdk/Cargo.toml
  • crates/auth-sdk/src/http.rs
  • crates/auth-sdk/src/lib.rs
  • docs/architecture/telemetry.md

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51caad9e-ce34-4ccc-8c98-9857efbadc29
Commits

Reviewing files that changed from the base of the PR and between baabe1a and 6d508e6.

Files selected for processing: 6
  • apps/auth-service/src/federation/tests.rs
  • apps/auth-service/src/lib.rs
  • crates/auth-sdk/Cargo.toml
  • crates/auth-sdk/src/http.rs
  • crates/auth-sdk/src/lib.rs
  • docs/architecture/telemetry.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The auth SDK now instruments outbound HTTP requests with http.client spans that record method, host, and response status. The auth service enables the SDK tracing target, tests span attributes for Google signing-key requests, and updates outbound telemetry guidance.

Changes: SDK HTTP telemetry

Layer / File(s) Summary
Instrument SDK HTTP exchanges
crates/auth-sdk/Cargo.toml, crates/auth-sdk/src/http.rs, crates/auth-sdk/src/lib.rs
The SDK adds tracing as an unconditional dependency. Http::send runs the exchange inside an http.client span, records method, host, and response status, and marks exchange errors and 4xx/5xx responses as errors. Documentation describes the span fields and behavior.
Configure and verify auth-service telemetry
apps/auth-service/src/lib.rs, apps/auth-service/src/federation/tests.rs, docs/architecture/telemetry.md
The auth-service filter includes piquel_auth=info. A federation test checks the Google signing-key request span’s parent, method, integer status, server address, and omission of the path and query. Telemetry guidance notes that SDK requests receive spans from the SDK.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant FederationTest
  participant KeyCache
  participant AuthSdkHttp
  participant GoogleKeyEndpoint
  FederationTest->>KeyCache: Verify signed token
  KeyCache->>AuthSdkHttp: Fetch Google signing keys
  AuthSdkHttp->>GoogleKeyEndpoint: Send GET request inside http.client span
  GoogleKeyEndpoint-->>AuthSdkHttp: Return response status
  AuthSdkHttp-->>KeyCache: Return signing-key response
Loading

Suggested labels: apps/auth-service

Merge Risk: Minimal · previous review 6d508

The SDK adds outbound request tracing without an identified merge-blocking issue.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: exposing Google's signing-key fetch in sign-in traces. It matches the pull request objectives and changeset.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files. (2 skipped: 2 unsupported.)

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit watched the requests flow,
With spans to mark the fields they show.
Method, host, and status appear,
While paths and queries stay unclear.
The keys return; the traces glow.

@PiquelChips PiquelChips self-assigned this Nov 2, 2026
@PiquelChips PiquelChips added the bug Something isn't working label Nov 2, 2026
@PiquelChips PiquelChips added this to the 0.1 milestone Nov 2, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in sourceorigin.dev Nov 2, 2026
@PiquelChips PiquelChips moved this from Needs Triage to In Progress in sourceorigin.dev Nov 2, 2026
PiquelChips and others added 2 commits November 2, 2026 17:00
… call

The Rust SDK now sends each request in an http.client span recording only
method, host and status, so KeyCache's JWKS fetches appear in sign-in traces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this from In Progress to Ready in sourceorigin.dev Nov 2, 2026
tracing-opentelemetry records unsigned integers as strings, unlike the
i64 send_traced exports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PiquelChips
PiquelChips force-pushed the fix/google-jwks-client-span branch from 6d508e6 to 73a4711 Compare November 2, 2026 18:04
@PiquelChips
PiquelChips added this pull request to stack #311 November 2, 2026 20:53
@PiquelChips
PiquelChips merged commit 4429344 into main Nov 2, 2026
9 checks passed
@PiquelChips
PiquelChips deleted the fix/google-jwks-client-span branch November 2, 2026 20:55
@github-project-automation github-project-automation Bot moved this from Ready to Done in sourceorigin.dev Nov 2, 2026
PiquelChips added a commit that referenced this pull request Nov 2, 2026
…can't drift apart (#310)

Stacked on #309.

#309 left two copies of the client span code: auth's `SendTraced` and
the one the Rust SDK grew for itself. They can drift apart, and
reviewing #309 showed they already had: both recorded the status code as
a `u16`, which tracing-opentelemetry exports as a string. That's fixed
in #309. This PR leaves a single copy so it can't happen again.

`SendTraced` now lives in `piquel-common`, behind a new `client-spans`
feature, which both auth and the SDK already depend on.
`piquel-telemetry` re-exports it, so auth's `.send_traced()` callers
don't change. The SDK's `Http::send` now calls it too.

**Changes in behavior:**
- The SDK's span now ends when the headers arrive, like every other
provider call.
- Apps using the SDK find its spans under the `piquel_common` target
rather than `piquel_auth`. The SDK docs say so.
- `piquel-telemetry` enables that target itself, so the
`piquel_auth=info` filter that #309 added to auth is gone again.

**Proof:** the test from #309,
`google_key_fetch_is_a_client_span_of_its_request`, now exercises the
shared `SendTraced`. It checks that the span sits under its request,
records method, host and status (as an integer), and contains no path or
query. It passes. `piquel-telemetry` and `piquel-auth` tests pass,
clippy is clean, and `cargo doc` with `-D warnings` is clean with and
without the feature. The net change removes code: 60 lines added, 76
removed.

Reviewed with review-loop: 2 rounds with 2× GPT-6.1 Sol and Claude Opus
5.5. Verdict: approved

> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by GPT-6.1 Sol
and Claude Opus 5.5 (via T3 Code)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant