Feature/per method timeout traceids injectable rpc#405
Open
valoryyaa-byte wants to merge 3 commits into
Open
Conversation
Implements configurable per-method timeouts so read-heavy methods like
getLeaderboard can use longer timeouts than quick lookups, without
changing the global default.
- Add TimeoutConfig type and TimeoutManager class (src/timeout.ts)
- Add RequestTimeoutError with { method, timeoutMs } (src/errors.ts)
- Add withTimeout() helper using AbortController; each retry attempt
gets a fresh timeout window
- Add timeout option to StellarSplitClientConfig
(e.g. { default: 10000, getLeaderboard: 30000, getInvoiceHistory: 20000 })
- Per-call override: sdk.getLeaderboard({ timeout: 60000 })
- sdk.getTimeoutConfig() returns resolved timeout for every known method
- Add getLeaderboard() and getInvoiceHistory() methods to client
- Export TimeoutConfig, TimeoutManager, TimeoutError, RequestTimeoutError
- Unit tests: timer fires correctly, fast path succeeds, error shape
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each SDK method call now generates a unique UUID v4 trace ID that
flows through telemetry hooks and RPC request headers, enabling
correlation of SDK calls with server-side logs.
- Add TraceIdManager class with setGenerator() for custom ID sources
(e.g. OpenTelemetry span IDs) and globalTraceIdManager singleton
- Add traceId field to TelemetryCallStartParams, TelemetryCallEndParams,
and TelemetryErrorContext; all telemetry hooks receive it
- Add X-Trace-Id header to outgoing RPC requests via interceptors
- Add traceId property to RPCRequest (src/interceptors.ts)
- _withTelemetry generates traceId per call and propagates it through
all hook payloads; callers can supply their own via opts.traceId
- sdk.setDefaultTraceIdGenerator(fn) allows custom generation
- Per-call override: sdk.getInvoice(id, { traceId: 'my-trace-123' })
- Export TraceIdManager, globalTraceIdManager, TraceIdGenerator
- Unit tests: UUID format, uniqueness, custom generators, hook payloads
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…esting Refactors the Soroban transport dependency into an injectable interface so callers can swap in custom transports for testing or alternative environments without monkey-patching. - Add RpcClient interface (src/rpcClient.ts): simulateTransaction, sendTransaction, getTransaction, getEvents, getLatestLedger, getAccount, getFeeStats - Add SorobanRpcAdapter wrapping SorobanRpc.Server (default, backward-compat) - Add rpcClient option to StellarSplitClientConfig; when provided it takes priority over container.getRPCClient() and the default server - server getter updated to return _injectedRpcClient first, enabling full transport substitution; connection-pool and retry logic wrap it - Add MockRpcClient exported from @stellar-split/sdk/testing: - Configurable per-call queued responses and errors - Tracks calls.simulate / calls.send / calls.getTransaction / calls.getEvents - queueSimulateResponse(), queueSendResponse(), queueGetTransactionResponse() - setDefault*Response() overrides; reset() clears state - Export RpcClient, SorobanRpcAdapter from package root - Unit tests: interface coverage, queued responses, error propagation, client accepts injected RpcClient and routes calls through it Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@valoryyaa-byte Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
summary