-
-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently the SDK library mode rejects streaming flags (--follow, --refresh) with an error. Commands like log list --follow and dashboard view --refresh yield multiple CommandOutput values over time via async generators — in library mode, these should return an AsyncIterable<T> that consumers iterate with for await...of.
Proposed API
const sdk = createSentrySDK({ token: "..." });
// Streaming: returns AsyncIterable
for await (const log of sdk.log.list({ follow: 5 })) {
console.log(log);
}
// Non-streaming: returns Promise (unchanged)
const logs = await sdk.log.list({ limit: 10 });Key challenges
- Async channel —
captureObjectneeds to push to a queue/channel instead of a single variable. Consumer reads viafor await...of. - Env lifecycle —
setEnv()cleanup cannot run until iteration completes. Needs deferred cleanup tied toAsyncGenerator.return(). - Telemetry span —
withTelemetryuses callback pattern. Streaming needs a handle-based approach where the span stays open during iteration. - SIGINT handling — Streaming commands use
process.once("SIGINT"). Library mode needs to wire teardown to the AsyncGenerator instead. - Codegen overloads — Methods with streaming flags need overloaded signatures:
Promise<T>without flag,AsyncIterable<T>with flag. - Concurrent env — Global
setEnvprevents concurrent streaming. Accept single-stream limitation or refactor to per-invocation env.
Estimate
~450-570 lines across ~12 files. Core channel is simple (~50 lines), integration is the bulk.
Context
PR #565 added the library SDK. Multi-yield accumulation was fixed (array instead of single var), but streaming flags are still blocked.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Fields
Give feedbackNo fields configured for issues without a type.