Skip to content

Conversation

@begelundmuller
Copy link
Contributor

@begelundmuller begelundmuller commented Dec 15, 2025

Implements a unified streaming endpoint that exposes the runtime server's streaming RPCs over a single SSE endpoint with the ability to serve multiple streams on a single connection.

This can be used to reduce the number of concurrent streaming connections, which may help alleviate blocked connections due to browsers limiting unsecured/localhost connections to 6 per origin.

Example:

> curl http://localhost:9009/v1/instances/default/sse?events=file,resource,log
event: file
data: {"event":"FILE_EVENT_WRITE",...}

event: resource
data: {"event":"RESOURCE_EVENT_WRITE",...}

event: resource
data: {"event":"RESOURCE_EVENT_WRITE",...}

event: log
data: {"log":{"level":"LOG_LEVEL_INFO",...}}

...

Details:

  • The unified endpoint is hosted at <runtime-host>/v1/<instance-id>/sse
  • It supports the following query parameters:
    • events: comma-separated list of event types to subscribe to. Supported values are: file, resource, log.
    • files_replay: maps to the underlying WatchFilesRequest.Replay
    • resources_kind: maps to the underlying WatchResourcesRequest.Kind
    • resources_replay: maps to the underlying WatchResourcesRequest.Replay
    • logs_replay: maps to the underlying WatchLogsRequest.Replay
    • logs_replay_limit: maps to the underlying WatchLogsRequest.ReplayLimit
    • logs_level: maps to the underlying WatchLogsRequest.Level

Closes https://linear.app/rilldata/issue/PLAT-356/unified-endpoint-for-streaming-apis

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@begelundmuller begelundmuller self-assigned this Dec 15, 2025
@begelundmuller begelundmuller marked this pull request as ready for review December 15, 2025 18:00
}

var level runtimev1.LogLevel
if levelStr := req.URL.Query().Get("logs_level"); levelStr != "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this by convention that logs_ is prefixed to all api param names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all the params that go to WatchLogsRequest have logs_ prefix, all the params for WatchFilesRequest have files_ prefix, etc.

@begelundmuller begelundmuller merged commit d28be47 into main Dec 17, 2025
15 checks passed
@begelundmuller begelundmuller deleted the begelundmuller/unified-sse-endpoint branch December 17, 2025 18:49
k-anshul pushed a commit that referenced this pull request Dec 18, 2025
* Unified streaming endpoint

* Lint

* Self review

* Self review

* Self review

* Fix int cast

* Review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants