X-SaaSus-Trace-Id 自動引継機能の追加#104
Open
takahujikeita wants to merge 1 commit into
Open
Conversation
- Extract X-SaaSus-Trace-Id from incoming request in AuthMiddleware - Add xSaaSusTraceId param to getAxiosInstance and inject header in interceptor - Propagate through all API client constructors Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
X-SaaSus-Trace-Id ヘッダーを、アプリケーションサーバー受信リクエストから取得して同一リクエストライフサイクル内の SaaSus API 呼び出しへ引き継げるよう、SDK 側のクライアント生成経路と axios インターセプターに伝播パラメータを追加する PR です。
Changes:
getAxiosInstanceにxSaaSusTraceIdを追加し、リクエストヘッダーX-SaaSus-Trace-Idを自動付与AuthMiddlewareでx-saasus-trace-idを読み取りAuthClientへ引き渡し- 各
*-client.tsのコンストラクタでxSaaSusTraceIdを受け取り axios インスタンス生成に伝播
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/interceptor.ts | axios インターセプターで X-SaaSus-Trace-Id を付与できるよう引数を追加 |
| src/modules/auth-middleware.ts | リクエストヘッダーから x-saasus-trace-id を取得し AuthClient に渡す |
| src/modules/auth-client.ts | コンストラクタで xSaaSusTraceId を受け取り getAxiosInstance に伝播 |
| src/modules/pricing-client.ts | 同上(Pricing) |
| src/modules/integration-client.ts | 同上(Integration) |
| src/modules/communication-client.ts | 同上(Communication) |
| src/modules/billing-client.ts | 同上(Billing) |
| src/modules/awsmarketplace-client.ts | 同上(AwsMarketplace) |
| src/modules/apilog-client.ts | 同上(ApiLog) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+39
to
+42
| let xSaaSusTraceId = ""; | ||
| if (req.headers["x-saasus-trace-id"]) { | ||
| xSaaSusTraceId = req.headers["x-saasus-trace-id"] as string; | ||
| } |
Comment on lines
+40
to
+42
| if (xSaaSusTraceId) { | ||
| config.headers!["X-SaaSus-Trace-Id"] = xSaaSusTraceId; | ||
| } |
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.
概要
X-SaaSus-Trace-Idヘッダーの自動引継機能を実装しました。アプリケーションサーバーが
X-SaaSus-Trace-Idヘッダーを含むリクエストを受信した場合、その値が同一リクエストライフサイクル内の後続の SaaSus API 呼び出しに自動的に転送されます。変更内容
src/modules/interceptor.ts:xSaaSusTraceIdを受け取り、axios インターセプターでX-SaaSus-Trace-Idヘッダーを付与src/modules/auth-middleware.ts: リクエストからx-saasus-trace-idを取得し AuthClient に渡すsrc/modules/*-client.ts: コンストラクタでxSaaSusTraceIdを受け取り伝播実装パターン
既存の
X-SaaSus-Refererの実装と同じパターンに従っています。